0

I have the following code and it has been working. Now our company merged and my computer is with the new company domain. New company don't have access to our SharePoint and it seems like it also want to do SSO (although I have -UseWebLogin). Any suggestions?

On one of the server I had to turn off "internet options > security > custom level > User authentication" auto to "prompt for user name and password"

# Connect to your SharePoint site Connect-PnPOnline -Url "https://your-sharepoint-site-url" -UseWebLogin # Specify the CSV file path $csvFilePath = "C:\Path\To\Your\File.csv" # Load the CSV data $csvData = Import-Csv -Path $csvFilePath # Specify the SharePoint list name $listName = "customerlist" # Iterate through each row in the CSV foreach ($row in $csvData) { $teamsName = $row."Teams Name" $primaryContact = $row."Primary Contact" # Get the SharePoint list item based on the "Title" column $listItem = Get-PnPListItem -List $listName -Query "<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>$teamsName</Value></Eq></Where></Query></View>" if ($listItem) { # Update the "Primary Contact" column Set-PnPListItem -List $listName -Identity $listItem.Id -Values @{ "Primary_x0020_Contact" = $primaryContact } Write-Host "Updated '$teamsName' with Primary Contact: $primaryContact" } else { Write-Host "No match found for '$teamsName'" } } # Disconnect from SharePoint Disconnect-PnPOnline 
3
  • Which version of PnP PowerShell are you using? Try using: Connect-PnPOnline -Url "https://your-sharepoint-site-url" -Interactive. Let me know if it works for you.CommentedMar 19, 2024 at 12:47
  • -interactive doesn't work with cloud i guess. also it's opening internet explorer instead of edge when i used -useweblogin
    – maria
    CommentedMar 19, 2024 at 15:29
  • Try installing latest version of PnP PowerShell and use -Interactive. Also, you can set default browser for your system to Edge so that it will open the Edge instead of IE.CommentedMar 19, 2024 at 16:10

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.