Hot answers tagged

3

Should you not do UserCustomAction.Update() after you set the new script source? (also you may want to store the action in a variable: try{ $theAction = $customActions.GetById($Id) $theAction.ScriptSrc = $ScriptSrc $theAction.Update() $context.ExecuteQuery() Write-Host "CustomAction $Id updated" -ForegroundColor Green } catch{ ...


3

Yes, there is a way. You need to use an SPQuery object (based on your SPView). Use the following PowerShell commands: $web = Get-SPWeb $($webUrl); $list = $web.Lists.get_Item($listName); $view = $list.Views[$viewName]; $spQuery = New-Object Microsoft.SharePoint.SPQuery($view) $spQuery.RowLimit = 0 $items = $list.GetItems($spQuery);


2

To add the certificate to the Central Admin trust is easy. You have to run the below command for each certificate. $cert = Get-PfxCertificate c:\CsAppTier.cer New-SPTrustedRootAuthority -Certificate $cert -Name CsAppTier c:\CsAppTier.cer is path & name of the certificate which you want an import. -Name CsAppTier, You can name whatever you want or ...


2

You can use below snippet Get-SPUser -Web http://server/sites/yoursite | Where { $_.IsDomainGroup } AD group is treated as a special user. So this can be find using the filter IsDomainGroup $SPWebApp = Get-SPWebApplication https://*******.com/ foreach ($SPSite in $SPWebApp.Sites) { write-host -foregroundcolor green "Working on Site ...


2

Refer to this post: Cannot update Created By (Author) field through powershell Basically you need to get a reference to the item, then do something like this: $SPListItem["Author"] = $userString; $SPListItem.UpdateOverwriteVersion();


2

You can simply use the SharePoint Management Shell instead which has pathing for psconfig, but instead, use PowerShell. Initialize-SPResourceSecurity is the replacement for that specific command.


2

If the site is not available in 1st and 2nd stage recycle bin then that means it is gone completely. Now the only option is to restore it from Backup. If you have backup of your site collection then restore just before you deleted the subsite. If you have content DB backup then restore it and using the Unattached Content Database recovery and export the ...


2

Unfortunately, persistent columns are sealed meaning they cannot be deleted once created. You got 2 solutions (workaround) that you can try: Hide the column instead of deleting it and remove it from the view it was added. Create a new document library and copy all the documents into it (you can utilize the Open in explorer for easy copy/paste and use the ...


2

You can use the following to copy site to another site within the site collection Site Setting --> Site Administration --> Content and structure --> Select the site from the left navigation and move To copy to another site collection: try using copy site as a template (include content) and then use the template file to create a new site under the other site ...


2

The powershell coverage is weak, so you aren't going to have export options like you would on prem. You would have to create a script with CSOM, as a compiled exe or in powershell, to perform the provisioning and copying data around. If this is a one off scenario that might be ok, if you foresee the need to do this often, you might want to invest in a ...


2

Use the PnP PowerShell CmdLets, and you can do this with one line of code: Add-SPOTaxonomyField -DisplayName "Region" -InternalName "Region" -TermSetPath "Contoso|Region" Documentation Implementation


1

You can try this script $web=Get-SpWeb "http://subsiteurl" $web.AllowUnsafeUpdates=$true $web.ServerRelativeUrl="/newRelativeURL/" $web.Update() $web.AllowUnsafeUpdates=$false


1

You can do the followin in PowerShell: #retrieve the SPO Operation return value during creation $spOnlineOperation = $tenant.CreateSite($properties) #load the tenant object $ctx.Load($tenant) #load the SPO operation $ctx.Load($spOnlineOperation) #run the command $ctx.ExecuteQuery() #wait for SPO Operation to complete while($spOnlineOperation.IsComplete ...


1

Firstly I agree with @Aveenav that you should look into the building wsp package, that will follow Sharepoint model, it will place the master page in layouts directory, push it if you connect servers etc. But if you really need to, you can place in the SP library, and call it from there (you can place in the layouts as well but you will have to keep that ...


1

Ok, using @Mohamed and @Hardik's answer.. I scripted the following which allowed me to update the "Created By" Add-PSSnapin Microsoft.SharePoint.Powershell $SPWeb = Get-SPWeb "http://server/site" $userName = "i:0#.w|domain\username"; $user = Get-SPUser -web $SPWeb -Identity $userName; $userString = "{0};#{1}" -f $user.ID, ...


1

Below mentioned code will help you to update Author based on some conditions. // Get the SharePoint Assembly // You will need to run this on the SharePoint Server [Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") // The site my list was in was at http://dev // create a new object called ...


1

I tested your script and found the problem. The answer is here http://stackoverflow.com/questions/35225511/sharepoint-csom-copy-roleassignment your last lines should be: # Apply the permission roles to the list. $clientContext.Load($folder1.ListItemAllFields.RoleAssignments.Add($usr, $usrRole)) ...


1

Have you tried this Deactivate Sandbox Solution with PowerShell in Office 365 Also have a look to this link too, it contains the way to deactivate solution I am not sure about this as i haven't faced this problem but i guess it can help you.



Only top voted, non community-wiki answers of a minimum length are eligible