SharePoint Online
8 TopicsA Guide to Change SharePoint Domain Name Using PowerShell
Are you troubled about your old domain name after the brand change of your company? Fortunately, you can now easily change the SharePoint or OneDrive URL using Microsoft PowerShell to maintain a consistent domain name in your organization. PowerShell provides simple cmdlets to initiate, check and stop the SharePoint domain name operation in your Office 365 environment. Using the below blog, you can get immediate assistance to change your domain name with the new custom domain and start confidently building your brand today! Let's dive deeper into SharePoint domain rename in detail. https://m365scripts.com/sharepoint-online/a-guide-to-change-sharepoint-domain-name-using-powershell/822Views0likes0CommentsError while coping file from one document library to other
PS C:\Windows\System32> $target = "/Destination/" PS C:\Windows\System32> $source = $File.FieldValues.FileRef PS C:\Windows\System32> $source /sites/####/Source/Leave Policy.pdf PS C:\Windows\System32> $targetFile = $target + $File.FieldValues.FileLeafRef PS C:\Windows\System32> $targetFile /Destination/Leave Policy.pdf PS C:\Windows\System32> Copy-PnPFile -SourceUrl $source -TargetUrl $targetFile -Force -ErrorAction Stop Hi there I am trying to copy file using the above method but getting this error message "Copy-PnPFile: {"odata.error":{"code":"-2147213275, Microsoft.SharePoint.Deployment.SPMigrationQosException","message":{"lang":"en-US","value":"Failed to verify the existence of destination location at 'https://#########.sharepoint.com/Destination/Leave Policy.pdf' due to error 'The system cannot find the file specified. (Exception from HRESULT: 0x80070002)'."}}}" I am not sure why it's not adding " sites/SiteName" in the target URL .... I tried to do it by adding manually but not working ...... any suggestion would be welcoming.4.1KViews0likes2CommentsSharePoint online CSOM authentication fails in prod works in dev and test tenants
Hi, I tried the below csom script to undeclare all the existing records in a sharepoint onlinelibrary. It works fine in dev and test tenants but fails in the production tenant. Any suggestions to fix this issue ?. I tried another option to use pnp instead of csom, it works fine to connect to the site & iterate the library documents. But i dont see any option to undeclare the record documents using pnp powershell and to get the client run time context using pnp. Thanks in advance for your help on this issue. $listname = 'ListName' $Username = 'Email address removed' $password = Read-Host -Prompt "Enter password" -AsSecureString $url = 'https://abcsharepoint.com/sites/test' $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($url) [Microsoft.SharePOint.Client.ClientRuntimeContext] $runTimectx = [Microsoft.SharePOint.Client.ClientRuntimeContext] $ctx.Web.Context; $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $password) $web = $ctx.Web; $ctx.Load($web); $ctx.Load($web.Webs); $ctx.ExecuteQuery(); $listUpdate = $web.Lists.GetByTitle($listname) $ctx.Load($listUpdate) $ctx.ExecuteQuery() #CAML Query to get all items inclusing sub-folders $spQuery = New-Object Microsoft.SharePoint.Client.CamlQuery $spQuery.ViewXml = "<View Scope='RecursiveAll' />"; $item = $listUpdate.GetItems($spQuery) $ctx.Load($item) $ctx.ExecuteQuery() for($j=0; $j -lt $item.Count; $j++) { if($item[$j].FieldValues["_vti_ItemHoldRecordStatus"] -eq 273) { [Microsoft.SharePoint.Client.RecordsRepository.Records]::UndeclareItemAsRecord($runTimectx,$item[$j]) } } Error : Exception calling "ExecuteQuery" with "0" argument(s): "The sign-in name or password does not match one in the Microsoft account system." At line:12 char:9 + $ctx.ExecuteQuery() + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : IdcrlException6.3KViews0likes3CommentsMicrosoft SharePoint Online Management Shell issue
have SharePoint Online Power Management Shell version 16.0.8316.1200 installed on my laptop. Now I want to install latest version of it, but previous version of the shell is not overwriting neither it is getting uninstall. When I runGet-Modulecommand I can see installed version but when I try runUninstall-ModuleI get error After further digging I found that it is installed throughProgram and FeaturesofControl Panel I try to uninstall but it always ask me to for original package file to uninstall so I cannot uninstall it too. I am stuck over here. Can somebody help me from where I can download old version of msi so I can uninstall reinstall latest version Somebody help me to resolve this issue5.8KViews2likes4CommentsPNP-PowerShell with MFA and multiple sites in CSV
Hello, I am trying to figure out how to assign Read permissions to a SharePoint Online Group in multiple sitecollection subistes. So far I was able to get this to work, however with PNP and MFA I find I do it ONCE and think I might have to do it again and again. Is there a way to log on with the site collection and then update the subsites, with MFA, and only log on once? Maybe use a CSV to scroll through? SharePoint Group is the same and Read Permission for all of the about 100+ subsites. I know that we want all SiteCollections; this is a migration from on-premises and so it probably will be around for a while. People don't like change and bookmark everything so to change it would cause issues. We have a few thousand people on our Tenant. Connect-PnPOnline -Url https://COMPANY-admin.sharepoint.com -UseWebLogin Connect-PnPOnline –Url https://COMPANY.sharepoint.com/sites/SiteCollection/Subsite –UseWebLogin Set-PnPGroupPermissions -Identity 'SharePoint Group Name' -AddRole 'Read' I just need to change this, for example: https://COMPANY.sharepoint.com/sites/SiteCollection/SubsiteA https://COMPANY.sharepoint.com/sites/SiteCollection/SubsiteB https://COMPANY.sharepoint.com/sites/SiteCollection/SubsiteC Yet, I don't want to log on multiple times, I hope to log on once and use the CSV (IF it is the best way to do this), to pull from. I don't mind pasting in a long Script, if it is better; again, all Read Only, and SharePoint Group. When migrating over, it was a local domain and that is not on our Microsoft 365 Tenant, so the group didn't "carry over" so I am using a SharePoint Group that does exist. Thank you.3.8KViews0likes2CommentsAdd-PnPClientSideWebPart not working in Sharepoint online
I am trying to add a new webpart (document library) using Add-PnPClientSideWebPart. I am using following code : Set-Variable -Name "NewDocLib" -Value ((Get-PnPList -Identity "NewDocLib").Id) Add-PnPClientSideWebPart -Page "Home" -Component $NewDocLib -Section 1 -Column 2 -Order 1 This is as per following article : https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnpclientsidewebpart?view=sharepoint-ps I am getting following error : Add-PnPClientSideWebPart : Value cannot be null. Parameter name: Passed in component cannot be null At line:1 char:1 + Add-PnPClientSideWebPart -Page "Home" -Component $NewDocLib -Section ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Add-PnPClientSideWebPart], ArgumentNullException + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.WebParts.AddClientSideWebPart Can I get some help?2.9KViews0likes1CommentRandom error with SharePoint Online PowerShell
I am running this command withSharePoint Online PowerShell: Connect-SPOService -Url "https://$orgName-admin.sharepoint.com" -Credential $userCredential Most of the time I get this error: Connect-SPOService : '=' is an unexpected token. The expected token is ';'. If I try again and again, it eventually goes through. This also happens with other commands. What could be the issue here?1.1KViews0likes0Comments