..:: I like SharePoint ::.. Rotating Header Image

Administration

SharePoint 2010 Powershell read lookup or person field & add value

Powershell is great, powershell can do really great things if you know how to. So i would like to share some experiences with you.

Basic: Get the list and the item of your list:



$Web = Get-SPWeb "http://server/sites/sitecollection"
$List = $Web.Lists["Listname"]
//All items where ID is equal "1" you can set it as you like
$Item = $List.Items | ? {$_["ID"] -eq "1"}
$groupcol = $Item["YourField"]


Reading the values of a lookup



$ValueCollection = New-Object Microsoft.SharePoint.SPFieldUserValueCollection
foreach($group in $groupcol)
{
$group.lookupvalue
}


Adding value to this field



//This value collection will be saved afterwords into the field and it overrides the old values
$ValueCollection = New-Object Microsoft.SharePoint.SPFieldUserValueCollection
foreach($group in $groupcol)
{
//Add the old values to the new Value collection
$ValueCollection.Add($group)
$myGroup.id = "1"
$myGroup.Name = "Test"
$GroupValue = new-Object Microsoft.SharePoint.SPFieldUserValue($Web,
$myGroup.id, $myGroup.Name)
$ValueCollection.Add($GroupValue)
}
$Item["YourField"] = $ValueCollection
$Item.Update()


Hope this helps.

..:: I LIKE SHAREPOINT ::..

SharePoint 2010 document icons are not displayed correctly

You installed the PDF iFilter or modified the docicon.xml in any case in the /template/xml folder of the SharePoint Hive in order to see afterwords pdf icons or other icons like word, excel, etc. But the icons are not displayed correctly? None of them? Well maybe you just have to check the docicon.xml again

Sometimes there are errors like

  • the image name is not correct
  • or the double quote in the map attribute is not correct

Correct double quote = ”

Incorrect double quote = “

So then first check twice that your docicon.xml file is correct.

..:: I LIKE SHAREPOINT ::..

SharePoint 2010 FilterZen webpart – Powerful filtering

This post is not meant to be an advertisment. It is more a summary of my experience with filtering lists and the lack of some possibilities with OOTB features of SharePoint. In this post i will just look at one feature which i needed for a customer.

About the scenario: In SharePoint the document library provides the functionality of using metadata navigation and metadata keyfilter webparts. This keyfilter webpart can filter the metadata column of a list /library. But the filter works only with an OR Operator on one column. That means, that one of the filter values needs to match at the column and it will display the row. Well my customer needed a solution which uses an AND Operator, so that the result will only be the items which have exactly both or all terms / filtervalues in their column. (more…)

SharePoint 2010 Administration service failed to start

I don’t know why but i got this error trying to start the SharePoint 2010 Administration service:

The SharePoint 2010 Administration service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.

But the solution which worked for me fine was the following:

You have to modify the service timeout values in the Registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control add/modify DWORD value ServicesPipeTimeout to 60000 (60 seconds)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control add/modify STRING value WaitToKillServiceTimeout to 120000 (120 seconds)
and Restart the server machine.

It is important to restart the server! I found this really nice help here.

..:: I like SharePoint ::..

SharePoint 2010 Move a Site Collection to another Content Database

Ever wanted to move a single Site Collection from Content Database A to Content Database B?

Well, the decision is sometimes really easy why to do so. If you are running out of free space in your content database, it may be better to separate the site collections into different content databases. This has something to do with planning your sites and the size you will need, but you also may know that you cannot plan everything in detail.

There are some steps to go through. At first you’ll have to create a new database, then you should move the site collection to the new database und afterwards you should look how to release the space from the old content database. Sounds easy, right? It is so. I make it a little more detailed. (more…)