Wednesday 28 September 2011

Dialogs Become Shy following Site Restore

I came across this following restoring a site collection the other day. When I selected an event item I received the message “The website declined to show this webpage” (see image below) – how rude !

image

The event item in question contains managed metadata. As we all know managed metadata is synchronised to a hidden list within the site collection aptly named: “TaxonomyHiddenList”. This list does not inherit permissions thus the security for the list was invalid which explained the curt response from the dialog framework.

I resolved the issue as follows:

Navigate to <sitecollection>Lists/TaxonomyHiddenList/ and follow the following six easy steps:

  1. Navigate to the "Pemissions for this list"
  2. Select Inherit Permissions
  3. Select Stop Inheriting Permissions
  4. Add Authenticated Users (NTAUTHORITY\Authenticated Users) with Read permissions
  5. Update the System account (SHAREPOINT\system) to have Full Control
  6. Remove all other users

Tuesday 27 September 2011

Bulk Deleting Site Collections

This is not for the faint hearted. The other day I was testing the creation of a few hundred site collections under a managed path; this went well until I came to the point of deleting them and performing another test, the UI is definitely not the way to go.

For your delectation please find below a one line power-shell command to bulk delete number prefixed site collections under a managed path:

Get-SPSite | Where {$_.url -match http://web/sites/[0-9]} | Remove-SPSite -Confirm:$false

Use at your own risk…

Filtering Log Files

I spend a good portion of my time examining SharePoint log files. While it is possible to reduce this time by using the excellent SharePoint Log Viewer it doesn’t give you the power that the old Unix Grep command gives. There is a similar command within Windows you will be glad to hear called FindStr.

FindStr searches for patterns of text in files using regular expressions. Here are a few real world examples:

Example 1 - create a text file of all lines that contain the string ​”Warning:” in the file myLog.txt

FindStr /L “Warning:” myLog.txt > warnings.txt

Example 2 - create a text file of all lines that contain the string ​”Warning:” in all text files recursively

FindStr /L /S ​”Warning:” *.txt > warnings.txt

Example 3 - create a text file of all lines that contain the regular expression all lines that contains ERROR and Object and output to a text file.

FindStr /R .*ERROR.*Object.* myLog.txt > errors.txt

Thursday 8 September 2011

SharePoint Designer 2007 Workflow – Configuring the default Task List

When creating a workflow within SharePoint Designer you will note that unlike the out of the box workflows it does not prompt you for the default tasks list.
To configure the Task list:
  1. Navigate to the task list you wish to use, select Settings, List Settings; Right click on Audience targeting settings or Information management policy settings and select Properties. Copy the list GUID from the address URL e.g. {b8b415e2-89fa-40cb-a598-85eec0cd6271}
  2. Navigate to the Workflow folder in SharePoint Designer and expand it
  3. Double click on the <workflow name>.xoml.wfconfig.xml file, locate the Association TaskListID and replace with default GUID with the new task list GUID from step 1.
  4. Save and republish the workflow
For more information on SharePoint Designer 2007 workflows see the Microsoft site.

Example of wfconfig.xml file:

<WorkflowConfig>
    <Template
        BaseID="{99CCD0B6-D5BC-46E4-A6C7-3054C2157FCE}"
        DocLibID="{6FA134EA-846D-46BD-8F2A-246D103A5A01}"
        XomlHref="Workflows/Test Workflow/Test Workflow.xoml"
        XomlVersion="V7.0"
    >
    </Template>
    <Association
        ListID="{FB7C61AA-3F15-4914-A965-C6F24ED2FD7F}"
        TaskListID="{b8b415e2-89fa-40cb-a598-85eec0cd6271}"
        StartManually="true"
    >
    </Association>
    <ContentTypes>
    </ContentTypes>
    <Initiation URL="Workflows/Test Workflow/Test Workflow.aspx">
        <Fields/>
        <Parameters></Parameters>
    </Initiation>
</WorkflowConfig>