Friday, 23 July 2010

Saving a Globally Reusable Workflow as a template in SharePoint Designer

This week I made the mistake of publishing a Reusable Workflow as a Globally Reusable Workflow in SharePoint Designer, deleting the original Reusable Workflow, and then trying to save the remaining Globally Reusable Workflow as a template – well, I soon found out that you can’t!

A moment of panic set in where I thought I would have to rebuild my workflow again from scratch, but came across the “Copy and Modify” option on the workflow context menu:

Workflow

This allows you to add a new Reusable Workflow back to the site using a copy of the Globally Reusable Workflow published earlier. I could then save the new Reusable Workflow as a template - Phew!

Friday, 2 July 2010

Open list item modal dialog (lightbox) with a hyperlink in SharePoint 2010

The modal dialog appears by default in SharePoint 2010 when you add, edit or view a list item from the List View Web Part. It’s the lightbox style look and feel where the background turns dark and a new dialog opens up on top, allowing you to view and edit items without having to leave the current page.

You may want to use this functionality with a hyperlink – for example in a Content Editor Web Part on a landing page. You can do this by using the code below:

<script type="text/javascript">
var options = {
url: "/Lists/Announcements/NewForm.aspx",
        title: "Add New Announcement",
        allowMaximize: true,
        showClose: true,
        width: 625,
        height: 525,
        dialogReturnValueCallback: silentCallback};
function open() {SP.UI.ModalDialog.showModalDialog(options);}
function silentCallback(dialogResult, returnValue) {
}
function refreshCallback(dialogResult, returnValue) {
    SP.UI.Notify.addNotification('Operation Successful!');
    SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}
</script>
<a href="javascript:open()">Click Here</a>
When you click on the “Click Here” link, it shows a dialog similar to the one pictured below:
Modal
A couple of things to note here – the “options” variable allows you to set the properties of the dialog, one of which is the dialogReturnValueCallback property. Setting this with the silentCallback function (used in the example above) returns to your landing page without a refresh. You can replace this with the refreshCallback function, which will refresh the page and show a pop-up message when an action is configured in the dialog. The best thing to do is play about with it and check out the difference.

Friday, 11 June 2010

Usage and Health Data Collection Proxy Stopped

I have been having a problem on SharePoint 2010, that has been there since beta but still exists on RTM. Everything worked fine when I first built the beta by running the Farm Configuration Wizard, but when I rebuilt the system and created the Service Applications manually in the Central Admin UI, the usage analysis Web Analytics reports were reporting zero results. I checked the Web Analytics services were started in Central Admin along with all the other usual checks and spotted that the Usage and Health Data Collection SA Proxy was Stopped in the Manage Service Application page:
UsageApplication SA Stopped
So I deleted the Usage and Health Service Application from the UI and recreated it using PowerShell with this script:

$serviceInstance = Get-SPUsageService
New-SPUsageApplication -Name "Usage and Health Data Collection Service Application" -DatabaseServer DBSERVER -DatabaseName "SharePoint_SA_Usage" -UsageService $serviceInstance > $null

However, the new SA proxy was still reporting Stopped and still no Web Analytics reports after 24 hours.
I decided to place a PSS call in the end and the answer lies in requiring to run a Provision method on the Usage and Health Data Collection Service Application Proxy after creating it in PowerShell. Therefore, if you already have a Usage and Health Service Application provisioned, you can change it by getting the GUID of the proxy from typing Get-SPServiceApplicationProxy and using it as in the below example:

$UP = Get-SPServiceApplicationProxy | where {$_.ID -eq "7636f85a-88eb-4ffc-8a31-8dbdd0812e14"}
$UP.Provision()

Create a new term in Managed Metadata with PowerShell

Use this script if you want to create a new term in the SharePoint 2010 Managed Metadata Service with PowerShell:

#Connect to Central Admin
$taxonomySite = get-SPSite http://centraladminsite:port

#Connect to Term Store in the Managed Metadata Service Application
$taxonomySession = Get-SPTaxonomySession -site $taxonomySite
$termStore = $taxonomySession.TermStores["Managed Metadata Service"]
write-host "Connection made with term store -"$termStore.Name

#Connect to the Group and Term Set
$termStoreGroup = $termStore.Groups["Group Name"]
$termSet = $termStoreGroup.TermSets["Term Set Name"]

#Create term, term description, and a synonym
$term = $termSet.CreateTerm("Test Term", 1033)
$term.SetDescription("This is a test", 1033)
$term.CreateLabel("This is a test synonym", 1033, $false)

#Update the Term Store
$termStore.CommitAll()

Wednesday, 2 June 2010

Content type publishing option missing from Site Collection Administration

Okay, you have set up your content type hub, published your content types and are now ready to use them in your lists and libraries. You go to your list, click to add from existing content types and your published content types aren’t available.

You may find this if the top level site in your site collection was created from the Blank Site template (there may also be other templates out there where this doesn’t work too). This is because the TaxonomyFeatureStapler feature does not include the Blank Site template.

You probably don’t want to go back and recreate your site collection again, so you can activate the feature manually by typing the following stsadm command:

stsadm -o activatefeature -id 73EF14B1-13A9-416b-A9B5-ECECA2B0604C -url http://toplevelsiteurl

Once activated, you will see the Content type publishing option appear in Site Collection Administration, as well as the Term store management option in Site Administration on the top level site. You should now be able to use your published content types as required – even in sub-sites (if not, you can repeat the stsadm command for your sub-sites, too).

Sunday, 30 May 2010

Issue indexing pages containing the Search Core Results Web Part in SharePoint 2010

I have spotted an issue with search on SharePoint 2010 when it tries to index a page containing the Search Core Results Web Part, which I am using in particular pages on a site to rollup content across an entire Web Application. When it tries to index one of these pages, the following message appears: "The SharePoint item being crawled returned an error when attempting to download the item”.

Usually, Search Center sites are created with the <noindex> attribute enabled, so you don't normally see this behaviour as the search results pages containing the Web Part are not normally indexed.​ You can choose an option in the crawl logs to prevent the page being indexed in the future, and it appears that this issue does not prevent the rest of the site from being indexed as long as the Search Core Results Web Part is not used on the home page of the site - I have noticed it can stop the whole site from bring indexed if it is.

Audience by Skills or Interests on SharePoint 2010

I have noticed that you can now create audiences based on the terms people select for Skills or Interests in their profile. I have used this to show personalisation links on My Sites whenever anyone selects certain keywords.

For example, if you enter "SharePoint" either as an interest or a skill in your user profile, a link to the SharePoint Team Site will appear in the top navigation bar of your My Site pages.

You could obviously apply this to any number of pages, links and Web Parts across the site, using it as a sort of self-subscription mechanism for exposing content of a particular subject matter.

Events 1001, 1004 & 1015

I have been getting a number of event log errors on my SP 2010 server similar to the Event 1004 shown below:

Log Name:      Application
Source:        MsiInstaller
Date:          07/05/2010 10:27:31
Event ID:      1004
Task Category: None
Level:         Warning
Keywords:      Classic
User:          NETWORK SERVICE
Computer:      SPSERVER.domain.internal
Description:
Detection of product '{90140000-104C-0000-1000-0000000FF1CE}', feature 'PeopleILM', component '{1C12B6E6-898C-4D58-9774-AAAFBDFE273C}' failed.  The resource 'C:\Program Files\Microsoft Office Servers\14.0\Service\Microsoft.ResourceManagement.Service.exe' does not exist.

I was also getting similar errors for other folders in the 'C:\Program Files\Microsoft Office Servers\14.0' path, so I resolved it by assigning Read permissions on the 14.0 folder to the NETWORK SERVICE user.

Access Denied when indexing sps3:// paths for People Search in SharePoint 2010

If you set a dedicated Default Content Access Account (recommended) for search indexing, you may find the following error when indexing the sps3:// path for People Search:

"Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. ( HttpStatusCode Unauthorized The request failed with HTTP status 401: Unauthorized. )"

I checked the Full Read permissions for the content access account as recommended, but these were correctly implemented. I then discovered that you have to add the content access account to the permissions of the User Profile Service Application by clicking the "Administrators" button when highlighting the User Profile SA in Central Administration.

Then, add the content access account to the list of administrators and assign it "Retrieve People Data for Search Crawlers" permissions, as shown below.

UserProfilePermissionsForSearch

Finally, start a full crawl in search to check the problem has been resolved.

Things to watch for when installing Office Web Apps

A few notes to pass on from my recent experience of installing Office Web Apps in SharePoint 2010:

1) I used the following PowerShell script to set up the Service Applications and associated proxies:

$AppPool = Get-SPServiceApplicationPool -Identity "SharePoint Service Applications Default"
New-SPWordViewingServiceApplication –Name "Word Viewing Service Application" –ApplicationPool $AppPool
$WdViewSA = Get-SpServiceApplication -Name "Word Viewing Service Application"
New-SPWordViewingServiceApplicationProxy –Name "Word Viewing Service Application Proxy" -URI $WdViewSA.Uri.AbsoluteUri
New-SPPowerPointServiceApplication –Name "PowerPoint Service Application" –ApplicationPool $AppPool
New-SPPowerPointServiceApplicationProxy –Name "PowerPoint Service Application Proxy" -ServiceApplication "PowerPoint Service Application"
New-SPExcelServiceApplication -Name "Excel Services Application" -ApplicationPool $AppPool

2) After creating the SA's, I started the Word Viewing, Excel Services, and PowerPoint services from the "Services on Server" option in Central Admin (I know I could have also done this in PowerShell, but it is just as straight forward from the UI!)

3) I was getting errors when trying to load any type of document in Office Web Apps so I checked the Event logs. I found Event 3760 which advised me that my service account for the SA application pool failed to logon to the SharePoint content database. I had a quick look around, but couldn't find anything concrete on what permissions the service account needed in SQL, so I gave it datareader and datawriter, ran an IISRESET, and tried again - same errors.

However, this time the event log reported Error 5214, telling me that I need to assign EXECUTE permissions to the SA application pool service account for the content database. To accomplish this, I created a db_executor role on each content database using the following SQL script:

CREATE ROLE db_executor
GRANT EXECUTE TO db_executor

I then opened up the properties of the SA application pool account in the Logins section of SQL Management Studio and assigned the db_executor role on each content database.