Wednesday, 6 April 2011

Decrypting error in multi-forest environment

In the ULS for a SharePoint 2010 Server after a trust between two domains has been re-configured: Decryption failed with error 0:" (and the rest of the callstack) Solution: stsadm -o setapppassword -password "SomeString" (on all WFE:s) stsadm -o setproperty -pn peoplepicker-searchadforests -pv "ForestDomainUserString" No IISResets needed.

Tuesday, 22 February 2011

Update-SPProfilePhotoStore and Service Application permission

Running Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation https:///my based on User Profiles – Picture Property in SharePoint 2010.

This command requires Full Control on the "User Profile Application" service application (Use the Permissions tab on the Manage Servcie Applications page).

Sunday, 9 January 2011

Solving ‘Configuring certificate’ hang for User Profile Synchronization Service.

The quick explanation:


1. If you re-provision the UPA service and encounter an error while creating the certificate, check this blog post by Paul Culmsee: More User Profile Sync issues in SP2010: Certificate Provisioning Fun.


2. If you delete the certificate in Trusted Root Certification Authorities and still are stuck on ‘Starting’ you also need to delete the certificate “higher up” in the certificate chain at Personal –> “ForefrontIdentityManager”.


A few good pointers:


Start to put the User Profile ULS category to Verbose, then read this blogpost by the SharePoint Escalation Team. Compare the ULS log entries you got with the blogpost, it´ll show where in the process the provisioning fails.


To unprovision the service run the powershell command: Stop-SPServiceInstance –Identity ‘'GUID’


Get the GUID by “Get-SPServiceInstance”, if you have more than one SP server in the farm you have two instances of the service name ‘User Profile Synchronization’, the one which is active has the status “Provisioning”. You might also need to delete the “UserProfileSyncronizationSetup” job before the unprovisioning can start.


In my case I could disregard these error messages in the ULS logs:


ILMPostSetupConfiguration: ILM Configuration: Validating installation of SQL Service. ILM Configuration: Error 'ERR_SERVICE_NOT_INSTALLED' ILMPostSetupConfiguration: ILM Configuration: Validating installation of SQL Service FAILED


Update: Another case required the removal of all subfolders in the MaData folder. I had alot of errrors regarding MS DTC before the removal


Thursday, 9 December 2010

Error message when adding a new column:

Culture ID 1164 (0x048C) is not a supported culture.
Parameter name: culture

The file "Microsoft.SharePoint.ApplicationPages.dll" has not been updated in the app_bin folders for each virtual server.

1. Stop the IIS service.
2. Copy the file from 12Hive\Config\Bin to all app_bin which have SP installed
3. The version of the file "Microsoft.SharePoint.ApplicationPages.dll" should be "12.0.6548.5000"
4. Start the IIS service again.

Friday, 3 December 2010

Downgrade of Enterprise to Standard editon for Sharepoint 2010

Downgraded a SQL cluster from Enterprise to Standard edition. Removed the cluster nodes first, followed parts of this guide to downgrade the edition and then configured the cluster again (most time was needed for the cluster configuration).

If you don´t restore the master database, you need to run "GRANT VIEW SERVER STATE TO [MyDomain\FarmAccount]" to avoid flooding of "Event 5586" with error message "
The user does not have permission to perform this action."

One thing that is not to obvioulsy is that the "Property Store" and "Web Analytics Service Reporting" database uses Enterprise functionality and can not be attached to a Standard edition.
You need to recreate the Service Applications for the Search Service and Web Analytics. So plan for it beforehand.

The Search Service can not be deleted i the UI, check this how to use stsadm to delete it. You also need to delete the Search DBs in the same way or else the Event viewer will be filled with connection errors for the orphan databases.

Wednesday, 10 November 2010

Code example for EnabledScript element in Ribbon XML

Andrew Connel explains how to enable and disable buttons in the Ribbon based on a condition.

I need to check a field value on the selected item and the item permission and then enable / disable multiple buttons. I assume that you have some knowledge about the Ribbon XML structure :).


//Should only be enabled when IssueStatus == Report
      <CommandUIHandler
Command="Tab.CloseIssue"
CommandAction="javascript:EditDeviation('{ListId}');"
EnabledScript="javascript:SingleEnable('Report',SP.PermissionKind.editListItems);"/>

//Should always be enabled
      <CommandUIHandler
Command="Tab.CurrentStatus"
CommandAction="javascript:DisplayStatus('{ListId}');"
EnabledScript="javascript:SingleEnable('All',,SP.PermissionKind.viewListItems);"/>


function SingleEnable(EnableForStatus, PermissionKind) {

var result = false;

var selectedItems = SP.ListOperation.Selection.getSelectedItems();
var ci2 = CountDictionary(selectedItems);
if (ci2 == 1) {

if (this.IssueRibbonItemId == null) {

this.IssueRibbonItemId = selectedItems[0]['id'];
var listGuid = SP.ListOperation.Selection.getSelectedList();
getStatus(this.IssueRibbonItemId, listGuid);

}
else if (this.IssueRibbonItemId != selectedItems[0]['id']) {

this.IssueRibbonItemId = selectedItems[0]['id'];
var listGuid = SP.ListOperation.Selection.getSelectedList();
getStatus(this.IssueRibbonItemId, listGuid);
}
else if(this.IssueRibbonStatus != null){

if (this.IssueRibbonStatus == EnableForStatus || EnableForStatus == '') {
if(this.IssueItem.get_effectiveBasePermissions().has(PermissionKind)){
result = true;
}
}
}
}

return result;
}

function getStatus(ItemId, listGuid) {

var clientContext = new SP.ClientContext();
var web = clientContext.get_web();
var lists = web.get_lists();
var list = lists.getById(listGuid);
this.IssueItem = list.getItemById(ItemId);

clientContext.load(IssueItem, 'IssueStatus', 'EffectiveBasePermissions');
clientContext.executeQueryAsync(Function.createDelegate(this, this.onStatusQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}


function onStatusQuerySucceeded(sender, args) {
this.IssueRibbonStatus = this.IssueItem.get_item("IssueStatus");
RefreshCommandUI(); //Makes the EnabledScrip method to be enabled again.
}

function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

Monday, 1 November 2010

Some TaxonomyField things and code

Before a new term can be used for tagging in a web site it needs to be added to the hidden list "TaxonomyHiddenList".
Several suggestions how to add a new term with code has been posted and this is my conclusion:

Adding a new term to an item:

TaxonomyField tf = item.Fields["ColumnName"] as TaxonomyField;
tf.SetFieldValue(item,term);
item.Update();

This doesn´t work for new items:

int hiddenTermId = -1;
int[] wssIds = TaxonomyField.GetWssIdsOfTerm(site, TermStore.Id, TermSet.Id, Term.Id, false, 1);

if(wssIds.Length > 0)
hiddenTermId = wssIds[0];

TaxonomyFieldValue tfv = new TaxonomyFieldValue(termId + ";#" + term.Name + TaxonomyField.TaxonomyGuidLabelDelimiter + term.Id.ToString())

or this:

string termString = String.Concat("-1", SPFieldMultiColumnValue.Delimiter, term.GetDefaultLabel(1033));
TaxonomyFieldValue tfv = new TaxonomyFieldValue(termString);

Add a comment if you have any question.

Friday, 27 August 2010

MissingSetupFile for themes

Running Test-SPContentDatabase for migration preparation. The report contained errors referring to missing themes files. The web didn´t use the theme as the active theme but had used the theme before.

Start SPD and open the site. Browse to the themes folder and delete the theme folder referenced in "MissingSetupFiles". Open the web in the browser and delete the folder from the Recycle Bin and then also from the site collection Recycle Bin.

Tuesday, 6 July 2010

Unexpected error creating debug information file

In several of my SharePoint projects I'm using a WinForm application to test and trigger SP code.

Sometimes I have had big problems when recompiling the SP projects and generating the PDB file. This time I disabled the VSHOST option for my WinForm project and the problem was solved.

VS spawns a new winformexe.vshost.exe process each time I tried to kill it with Process Explorer, so it kept me from recompiling the other SP corrctly.

How to: Disable the Hosting Process

Monday, 10 May 2010

WSPBuilder and VB.Net

Developing a solution for a client which want´s the sourcecode in VB.Net (It took some hours before I stopped using ";" and "{}" ;) ).

A known fix for getting all ASP.Net items available in a WSPBuilder project is to amend the .csproj file with a ProjectTypeGuids element. The same goes for VB.Net but the element that needs to be added is different:

{349c5851-65df-11da-9384-00065b846f21};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}

Wednesday, 28 April 2010

WebTemplate

Have noticed a long awaited feature in SP2010: WebTemplate! This means that you can add a template definition for one site collection only and not for the whole farm.

Monday, 26 April 2010

MCPD!

Passed the last certification and got the rewarded the MCPD credential. Actually the first title since my MCSE for Windows Server 2000. Have only been taking subject specific certificats since then, mostly SharePoint ofcourse.

Wednesday, 21 April 2010

jQuery and the find selector

When working with XML in jQuery a selector called $find can be used to find elements in the XML object that is loaded. I had a problem with IE7 and a webservice returning XML. The problem was that IE 7 didn´t recognize the returning XML as an [object] but rather as a string. Adding a dataType attribute to AJAX method solved the problem.

Solution reference: http://www.gammageek.com/2008/10/jquery-xml-in-ie.html

Wednesday, 24 February 2010

Enable debugging for _layouts files

I wanted to see the ASP.net error for files in a subdirectory to _layouts folder. So I created a web.config in the subfolder with this content:


<configuration>
<sharepoint>
<safemode maxcontrols="200" callstack="true" directfiledependencies="10" totalfiledependencies="50" allowpageleveltrace="false">
<pageparserpaths>
</pageparserpaths>
</safemode>
</sharepoint>
<system.web>
<compilation batch="false" batchtimeout="600" maxbatchsize="10000" maxbatchgeneratedfilesize="10000">
<httphandlers>
<add type="System.Web.UI.PageHandlerFactory, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" path="*.aspx" verb="*">
</httphandlers>
<customerrors mode="Off">
</SYSTEM.WEB>
</configuration>

Save the file and your ASP.Net error messages will appear.

Friday, 4 December 2009

Push changes from a content hub

1. Change or add a content type in a content hub site.
2. Click on "Manage Publishing for this content type" in the content type administration page.
3.Click on "Publish" if it´s a new content type or "Republish" if it´s a content type update.
4. Fire up "SharePoint 2010 Management Shell" on the SharePoint server.
5. Run these commands to trigger the timer jobs for content hub sync:

Start-SPTimerJob MetadataHubTimerJob
Start-SPTimerJob MetadataSubscriberTimerJob

6. Check your "Job History" (Monitoring --> Check job status --> Job History) page in CA for the status of the timer jobs

Sunday, 29 November 2009

Updatelistitems and 0x8007000

Using the UpdateListItems webservice from jQuery creating an item in a custom list returned the error: "0x80070005 The operation failed because an unexpected error occurred. (Result Code: 0x80070005)".

The webservice call worked correctly for site collection admin and site admins but not for ordinary users. The list was configurd with "Add item" and "View pages" permissons for ordinary users which should provide correct access for the UpdateListItem method.

The problem with the list was that is was configured with a "None" value for the property "Edit access" (General settings --> Advanced settings). After changing it to "Only their own" the method call succeeded. So the "Edit items" property was messing up a "New item" method call.

Updatelistitems and 0x8007000

Using the UpdateListItems webservice from jQuery creating an item in a custom list returned the error: "0x80070005 The operation failed because an unexpected error occurred. (Result Code: 0x80070005)".


The webservice call worked correctly for site collection admin and site admins but not for ordinary users. The list was configurd with "Add item" and "View pages" permissons for ordinary users which should provide correct access for the UpdateListItem method.


The problem with the list was that is was configured with a "None" value for the property "Edit access" (General settings --> Advanced settings). After changing it to "Only their own" the method call succeeded. So the "Edit items" property was messing up a "New item" method call.

Thursday, 26 November 2009

OT: Copy contacts between C905 and Satio

Switched telephone to a Satio yesterday :). But had some trouble to get my PIM information to come along. I´m running the Office 2010 beta so PC Suite from SEMC didn´t recognize it, the otherwise excellent MyPhoneExplorer could only move SMS and bookmarks between the phones. The solution was to use the Synchronization service from SEMC (still in beta). It worked perfect and now I also have the possibility to schedule an online backup directly from my phone.

Friday, 20 November 2009

Move My Site web application in MOSS 2007

We had a situation where a brand new web application needed a new host header and be moved from a high port to port 80.

Use this guide to add a host header.

Make sure you use the Default zone (or else you can not browse to 'Advanced Permissions' or add web parts).

Update "My Site" settings in the SSP

Recrawl the content source which index the user profile database, or else you will not be able to search for users.

Fix Hyper-V VHD for Virtual Box 3.0.10

I downloaded the Windows 2008 x64 VHD from Microsoft with the purpose to mount it in Virtual Box. When the virtual machine started the following error message was displayed: "Fatal no bootable medium found system halted".

The solution was to download VPC 2007 and run the Disk Wizard and compact the VHD (as stated here).