New answers tagged

0

To remove permissions for a given user: $clientlist.RoleAssignments.RemoveById($userOld.ID) This will remove all permissions for a given user. You can use the same method on folders or list items.


0

What about trying this? SPGroupCollection $groups = $site.SiteGroups; instead of $groups = $site.RootWeb.sitegroups


0

Connect to your SharePoint Site # Bind to site # $Context = New-Object Microsoft.SharePoint.Client.ClientContext("Your URL") $Credentials = Get-Credential -Message "Enter your credentials for SharePoint Online:" $Context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Credentials.UserName,$Credentials.Password) # Get ...


0

Try this link reusable codes are available just copy and paste the codes and change the web url. http://www.topsharepoint.com/list-all-checked-out-items-using-powershell http://social.technet.microsoft.com/wiki/contents/articles/12966.sharepoint-2010-powershell-script-to-list-the-documents-checked-out-with-version-details-in-a-site-collection.aspx ...


3

(A code-only option, as an extra, not necessarily a suggested answer but one for others who will in future come across this question) I'm surprised nobody's brought up the pretty awesome Patterns and Practices Remote Timer Job Framework https://github.com/OfficeDev/PnP/tree/master/Solutions/Core.TimerJobs.Samples Basically it's a .NET library that lets ...


1

You can try the below "Get All Checked Out Documents with no Checked In Version" [System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”) function CheckedOutItems() { $url=Read-Host “Please Enter In Site Url” “SiteURL ‘t” + “FileName ‘t” + “CheckedOutTo ‘t” + “ModifiedDate ‘t” + ...


5

Workflows The last option I'd go with is the workflow: workflows are slow, buggy, do not work at all when there's a lot of them running, complicated to debug, and most of all they completely disturb the users since they're visible in the UI (with a messy UI). Why would a background task be visible in the UI? In adition, conceptually, your task is not a ...


3

To be honest, based on the requirements: Check if a column named "Review Date" of an item is met (Review date = today), and if so, to change the item status to be "In Progress". Then to send an email to the "Assigned To" user , that there is an item assigned to him with “Review Date” that have been met. I would go for a Workflow. Why? ...


1

Typically when these types of errors occur, it is best to abandon the Content Database. Create a new Content Database on the Web Application, then use Move-SPSite to migrate each Site Collection to the new database. Once you've migrated to the new Content Database, perform an iisreset, then detach the old Content Database.


0

Please see an example below: $username = "admin@domain.onmicrosoft.com" $password = "Password" $url = "https://domain.sharepoint.com/sites/Test" $path = "C:\temp\test"; $destination = $url + "/Shared Documents"; #lib partial url $securePassword = ConvertTo-SecureString $Password -AsPlainText -Force # the path here may need to change if you used e.g. ...


0

I know it's an old post but I had the same issue and I think it's a good thing to share my solution with you. I've built a function which does the job: function enableCatalog($arrayOfLists) { foreach($list in $arrayOfLists) { write-host "Enabling catalog on list " $list -foregroundcolor Yellow ...


0

This is an old question, but in case you are still looking for an answer: the value of the ItemURL parameter has to be a valid relative URL, i.e. it has to start with a / character. Check the values you are putting in $spListUrl.


-1

Instead of Url try Link property $NavigationNode.Link = $ItemUrlPath


3

You just need a small change to your PowerShell script. $web = Get-SPWeb http://webUrl $groupOwner = $web.SiteGroups["GroupA"] #this group will own "GroupB" $groupTarget = $web.SiteGroups["GroupB"] $groupTarget.Owner = $groupOwner $groupTarget.Update() For all groups in a web: $web = Get-SPWeb http://webUrl $groupName = "SharePoint Group Name" #this will ...


1

you can do it couple of ways. Backup and restore Site collection Backup the site collection in question ( backup-spsite) move the backup to test farm restore the site using restore-spsite. Move site into own content DB create a new content db use move-spsite to move the site collection into the new content db now use Database baackup or restore ...


0

You will want to use the SharePoint Unattended Content Database Restore method. The TechNet article linked provides the exact steps that you need to follow.


0

if($folder.item.HasUniqueRoleAssignments -eq "True"){ foreach($role in $folder.item.RoleAssignments){ if($role.RoleDefinitionBindings.Name -ne "Read") { $role.RoleDefinitionBindings.RemoveAll() $role.RoleDefinitionBindings.Add($roleRead) $role.Update() } } }


0

What you want to achieve is not possible: a sub-site (a list, a folder, an item) has: Either the same permissions than its parent. In this case, permissions cannot be edited at all at the child-level. Or unique permissions. In that case, you can do whatever you want (including copying parent permisssions + add new ones), but anything done at the ...


2

I think that this could be your solution: Add a User or Group to the SPWebApplication User Policy for all Web Applications in the farm The interesting code should be Get-SPWebApplication http://sharepoint2010 | foreach { $webApp = $_ $policy = $webApp.Policies.Add($userOrGroup, $displayName) $policyRole = ...


0

This might work ###Public Variables $SQLServer = "Server\Instance" $MyUser = "domain/account" $spDatabases = Get-SPDatabase ####Private Variables $SqlConnection = New-Object System.Data.SqlClient.SqlConnection $SqlConnection.ConnectionString = "Server = $SQLServer; Integrated Security = True" $SqlConnection.Open() $SqlCmd = New-Object ...


0

Answer was discovered by user: $SiteUrl = "http://inside.power.gov" $web = Get-SPWeb $SiteUrl $ListName = "Survey List" $List = $web.Lists[$ListName] $csv = import-csv "c:\updateddata.csv" foreach($item in $csv) { $spItems = $List.GetItemById($item.ID) write-host $item.Region write-host $item."Phone Number" write-host $spItems["Region ...


2

You can use the script to give specific users the db_owner role. Don't forget to dd all users to users.txt. [System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.SqlServer.Smo’) | out-null $Users = get-content c:\users.txt Foreach ($User in $Users){ $InstanceName = "" $NewOwnerLoginName = $user; $smosvr = New-Object ...


3

If they're the same Site Collection, that is, have the same Site Collection ID, you cannot mount it to the same farm. Instead, you need to run Backup-SPSite and Restore-SPSite (good up until ~20GB in SC size) which will generate a new Site Collection ID, and also allow you to restore it at a different path.


1

through powershell or c-sharp code


0

You can create a calculated column with the following formula: =CONCATENATE("<img src='http://www.google.com/s2/favicons?domain="&[you-url-column]&"'/>")


0

If you have a list of documents you would like to download from a csv or database you can use System.Net.WebClient to download the documents based on URL. $clnt = new-object System.Net.WebClient $clnt.UseDefaultCredentials=$true foreach ($doc in $doclist) { $clnt.DownloadFile($downloadURL, $DestinationPath) } if($clnt){$clnt.Dispose()} In our case ...


1

You need two HostHeaders( DNS), then you can create more than one Web App on single Port. I.e If you have www.abc.com and www.efg.com, On the Web Application Creation Page. Enter the Name of Web app, Port Number and HostHeader. ...


1

As long as you use Host Headers for both web applications, you should be fine. Take a look at the New-SPWebapplication cmdlt and be sure to specify the hostheader parameter when creating the web applications.


0

Several methods allow you to retrieve the specific version by its ID or label and since you are about to delete them, I think DeleteByLabel() is the most appropriate: file.Versions.GetById() file.Versions.deleteByID() file.Versions.DeleteByLabel() For Powershell: $file.Versions.DeleteByLabel($Label)


0

There is a div with id="status_preview" right under the starting <body> tag. Execute document.getElementById('status_preview'+'').style.display='none' to hide it (try it in devconsole of your browser). There are a lot of ways to do it in SP, the fast & dirty one is to modify your masterpage to include lines like: <SharePoint:ScriptBlock ...


1

To list all master pages: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue; Get-SPWebApplication | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, MasterUrl To download a specific file / master page: $fromsite = "<your sp url>" $fromfile = "/_catalogs/masterpage/seattle.master" $tofile = ...


2

To find out what databases the IDs correspond to, run: Get-SPContentDatabase | Select ID,Name


2

It looks like at some point, you tried to configure Workflow Manager to work with SharePoint (so you can create/deploy/use 2013 mode workflows). To do so, you set up Workflow Manager (a dedicated -free- product) and then connected SharePoint to it. Workflow Manager generally sets up on http://<WFserver>:12291/, where WFserver is the Web server you ...


0

It's most likely because you are updating the $itemfile instead of $item. Try this: foreach($item in $file) { $item.Name $item.ContentTypeId $itemfile = $item.file $itemfile.CheckOut() $item["ContentTypeId"] = "0101009B1F3022B2A90E49A6CD5145086FDAEC" $item.Update() $itemfile.CheckIn("") $item.Name $item.ContentTypeId }


1

Document libraries are derived from lists under the covers. So your example above should also work for a document library. Take a look at this example from another question previously posted. You can see the code is very similar: Traverse through List of Documents using PowerShell


0

ChathuraSam hasnt understood the question as his comment relates to running a search using a managed property that has already been created whereas the question is clearly about creating managed properties using CSOM. Unfortunately I dont have enough reputation to comment. I believe the way to do this (although I havent tried this myself) is with ...


0

You can mix this in your powershell script to strip off the html: $string = <your rich text column> $string -replace '<[^>]+>',''


1

Try using the Get-SPCustomizedPages PowerShell cmdlets written by Gary LaPointe.


1

If you are looking to create an site collection, you need to create an explicit managed path for "/search". In central administration, under the manage web applications screen, highlight the web application, then select managed path. Create an explicit managed path called "/search" and try your powershell script again.


1

You were very close, since navigation has a hierarchical structure in order to create a child node the parent node should be determined first. The following example demonstrates how to create a child (Link) node under Heading node in Global navigation: Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server ...


2

Yes, unfortunately this is default behavior. But there are ways around it. You can’t rename AppPools in the IIS, but you can create another AppPool and move the applications to the new AppPool. It’s a tedious work and you shouldn’t do this unless it’s absolutely necessary. Instead, fire up you SharePoint Management shell and type: ...


1

In order to use Taxonomy terms to a taxonomy field using PowerShell, we need to involve SharePoint Object Model from PowerShell, and then use the Object Model to add terms in a termstore to the field. Below is the same code for your reference. Please add the logic in the For-Each method: Site Collection URL - Give your site collection url in quotation ...


1

I found I needed to add it, check it out, call update, check it in and publish it. So: $web = Get-SPWeb $site $folder = $web.getfolder("_catalogs/masterpage") $files = $folder.Files $mPage = Get-Item "C:\path to your\masterpage.html" $file = $files.Add("masterpage.html", $mPage.OpenRead(), $true) $file.CheckOut() ...


0

I have only the permission to view the source list, but not editing. And I can create new lists in the destination site. And yes, this should be a process, in order to have data from multiple source lists, that gets automatically transmitted to my destination list.


0

You can perform a batch operation to do updates on many ListItems at once. example.


0

If you're asking about running a PowerShell script from server-side of a Web part, that is technically possible but not recommended. Here's how you can do it (you'll find a lot of articles on the subject on the Web): http://blogs.msdn.com/b/kebab/archive/2014/04/28/executing-powershell-scripts-from-c.aspx or ...


0

I'm not sure if I anderstand it right. But powershell is for scripting on the server. With powershell you can for example acces to to webparts and change their parameters from server console (shell, PowerShell ISE console). May be you are asking about codebehind c# code, which you can use on on premis SharePoint (not in Sharepoint online). I'm afraid you ...



Top 50 recent answers are included