Posts

Showing posts from May, 2012

Synch User Fields when copying lists from one sitecollection to another

If you copy a list from one sitecollection to another one with a list template and the copied list has user fields than you'll have other users in the destionation list. This occures because SharePoint saves all user in a own UserInfo table for each sitecollection. A user in SiteCollection 1 can have the ID 5 and in another the ID 3. As the SPUserField is a LookUp Field to the User Info List the name of the User in the destination list can change. Two little PowerShell Scripts can help here. The first one reads the user info for a field in the source list and creates a csv with the information. The second one reads the csv and updates the destination list. Copy the code to two .ps1 files. Open the SharePoint 2010 Management Shell and run the "Dump user Info" script to dump the infos to a .csv file. Afterwards run the second script to update the destination list. Dump User Info # Adapt these values $web = Get-SPWeb "http://sharepoint/sites/sourcelis

Copy SharePoint Lists between sites with different language templates

Image
An easy way to copy a list with content between to sites is to create a list template, upload it in the other site to the list template gallery and create a new list with the uploaded template. The problem starts when the site templates have different languages. For example you create a list template in a site with english site template and you upload it to a site with a german site template, you'll not see the template in the create page. A way to change this ist to modify the.stp file, which is created when you make the list template. SO the first steps are: Create a list template. You can do this in the list settings. Just click "Save list as template" and give in the the filename and the template name. Download the created template to a local folder. Extract the template file Now we will modify the .stp file. An .stp file is nothing more than a microsoft cabinet file. Therefore rename the file from "mylist. stp " to "mylist. cab ".

Item-Level Permission for a SharePoint Document Library

The SharePoint Document Library doesn't have the option in his UI-Settings to change the item-level permisssions like normal SharePoint lists. This means that you can't create a document library in which only user who created the documents can only see their documents and no one else. You can simulate the behaviour by changing the permissions on each single document but this could be expensive and could also cause performance issues on  large libraries. The better option is the activate the item level security by PowerShell. It seems that Microsoft  only disabled the UI Option but with PowerShell you can reactivate it. I don't know why Microsoft disabled this option but in my tests this method worked very well. $web = Get-SPWeb http://YourSite/ $list = $web.Lists["Your Document Library Name"] $list.ReadSecurity = 2 $list.Update() $web.Dispose() What the values for ReadSecurity property means can be seen here . There is also a property