SharePoint user group meeting, Edinburgh 5th May 2010

April 13, 2010 Leave a comment

SUGUK I am very excited to announce that the next SUGUK meeting in Scotland is scheduled for May 5th at Microsoft, Waverly Gate, Edinburgh.

   

Spencer Harbour http://www.harbar.net/articles/About.aspx (MVP) will be discussing

Scaling SharePoint 2010 Topologies
Learn about the new SharePoint Service architecture, and how you architect Services for your organization. We will talk about various Canonical SharePoint deployment types (Internet Presence, Partner Collaboration via Extranets, distributed/consolidated data centers, medium sized organization etc.) and describe how you architect the Services logical topology. In addition to the logical topology, we will drill into how you scale-up/scale-out the physical topology to meet the scale expectations for your organization. Regardless of the nature and scale of your organization, SharePoint 2010 now offers a topology for you!

and Jess Meats http://blogs.technet.com/jessmeats/default.aspx from Microsoft shall be diving into the new workflow capabilities in SP2010 including the visual design capabilities within Visio 2010.

 

SharePint

The invite obviously extends to SharePint at the pub afterwards for a more informal discussions on SharePoint over a beer or two.

 

The Time

Doors open at 5:30 and will begin promptly at 6:00, with the obligatory half-time pizza and refreshments.

 

The Venue

Microsoft Offices, Waverly Gate, 2-4 Waterloo Place, Edinburgh, EH1 3EG

Directions : http://www.microsoft.com/uk/about/map-edinburgh.mspx

Posting on SUGUK.ORG : http://bit.ly/cuapXW

Technorati Tags: ,,
del.icio.us Tags: ,,
Categories: SUGUK Tags: , ,

Run Visual Studio 2010 as administrator – by default

February 26, 2010 1 comment

visualstudio2010 Simple thing but you often need to run VS2010 as administrator, certainly if you are going to be doing much debugging with SharePoint 2010. You can make this behaviour automatic by carrying out the following steps.

 

1. Right click the short cut to VS2010 and select  ‘Properties’

image

2. From the properties window select the ‘Advanced’ button

image

3. Check the ‘Run as administrator’ checkbox – Your done :)

image

Simple way to get the 4-part strong name for an assembly

February 26, 2010 2 comments

As you will know when building SharePoint solutions you always need to determine the 4-part assembly name or Strong Name for inclusion in various solution and feature manifests. I typically got this by pointing Reflector at my compiled DLL files.

image

Simpler way using Power Shell

Using the ‘External Tools’ option within visual studio you can create a quick link, so from your solution just click the ‘Get 4-Part Name’ link and out pops the 4-part assembly name in you’re output window.

image

Resulting output window…

image

How to add a new External Tool

Select ‘External Tools…’ from the Tools menu in Visual Studio

image

TITLE : Give the tool a title. You can use an ‘&’ character which will act as a short cut i.e. ALT+G.

COMMAND : powershell.exe

Arguments: -command "[System.Reflection.AssemblyName]::GetAssemblyName(\"$(TargetPath)\").FullName"

3. Make sure you check ‘use output window’ to post the result in the VS output window.

 

Simple but a great time saver :)

Installing SharePoint 2010 (RC) not allowing you to select the installation type and installs as single server.

February 17, 2010 5 comments

 

Noticed a problem when trying to install SharePoint 2010 release candidate on win 2008 running as a DC.

 

Problem:

The setup was not prompting you for the server type ‘Single Server’, ‘New Farm’. Instead the install would install SharePoint and SQL server express. The configuration wizard would then setup SharePoint as a single server.

Workaround:

Copy the setup.exe to a local directory on the server eg : c:\SPSETUP then open a command prompt ‘as administrator’ and run the following

 

c:\SPSETUP\setup.exe /extract c:\SPSETUP

Then from the SPSETUP folder run the install with the following command

 

setup.exe /config c:\spsetup\File\SetupFarm\config,xml

The install shall run as normal, but this time when the configuration wizard is run you should get the prompts to specify the appropriate configuration database server.

 

If you are running as a single server and using SQL Server Express then I also noticed this problem…

Also noticed that the config. wizard fails at step 5 due to it timing out. Thanks to some other postings I discovered this was due to the Sharepoint Server Search 14 and later on the SharePoint Foundation Search V4 service was being restarted by the configuration wizard. When the service is restarted it was using the ‘Local Service’ account. You can see this happening if you watch the services while the config. wizard is running. If before running the wizard you change these to run with appropriate domain accounts these should start up ok.

 

Creating an RSS Generator in SharePoint

January 18, 2010 3 comments

imageI recently had to create an RSS feed generator of SharePoint content and required a bit more flexibility that the out of the box SharePoint RSS feeds. There may be a number of approaches to this but here is an outline of how I did this…

 

So what do you get out of the box?

You enable RSS within your site collection/site via site settings. You also need to enable RSS on the specific list or document library. You do this via the list settings.

When enabled users see a new link from the list ‘Actions’ menu…

image

This link calls the page listfeed.aspx which you can find in the LAYOUTS folder within the 12 HIVE. It’s worth taking a look at the code behind for this page which is contained within the Microsoft.SharePoint.ApplicationPages.dll which you can find in the _app_bin folder of any SharePoint site (And not the GAC). Using Reflector take a look at the class ListFeed and you will get an idea on how the RSS feed work.

There are a couple of query string fields which can be passed to this page. list and View the list is expecting the source list GUID and the view is looking for a lists view GUID. The thing I found odd was that even if you are in the a specific list view if you click the view RSS feed link you still only get of the an RSS feed back which is the default view i.e. the query string ‘View’ is not used? You can manually put this in an it works? Perhaps I’m missing something here?

The render method of this class calls the WriteRssMethod of the corresponding SPlist. This method is overloaded as follows

Name Description
SPList.WriteRssFeed (Stream)
Writes the RSS feeds from the list to the specified document stream.
SPList.WriteRssFeed (Stream, Int32)
Writes the RSS feeds from the list that are associated with the specified meeting to the specified document stream.
SPList.WriteRssFeed (Stream, Int32, SPView)
Writes the RSS feeds from the list that are associated with the specified meeting and view to the specified document stream.

 

Building your own RSS generator

Anyway my requirements had to cater for

1. Return content which maps to specific content type fields

2. Return content from a specified view within a list – I used the view to filter and sort the content although I could have easily just done this in using SPQuery

I created a SharePoint solution with a new application page which would be mapped to the LAYOUTS  folder within the 12 Hive

The application page, called rssFeed.aspx contains the following mark-up

 

<%

@ Assembly Name=”chrisforbesblogs.RSSTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8e473a8929984006″ %>

<%

@ Page Language=”C#” Inherits=”chrisforbesblogs.RSSTest.rssFeed” %>

<%

@ OutputCache Duration=”300″ VaryByParam=”xsl;web;page;wp” VaryByCustom=”rights;feedresults”%>

In the same solution I created a class file called rssFeed.aspx.cs with the following inheritance from LayoutsPageBase

using System;using System.Collections.Generic;using System.Text;using Microsoft.SharePoint;using Microsoft.SharePoint.WebControls;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.Xml;using System.Globalization;

namespace chrisforbesblogs.RSSTest{    public class rssFeed :LayoutsPageBase    {

Fields to store relevant objects

protected SPList spList;protected SPWeb spWeb;protected SPView spView;protected string viewName;protected string listName;
 
In the class I override the OnLoad method. I get the query string values for the required  list and view name and store these in class fields
protected override void OnLoad(EventArgs e){    base.OnLoad(e);

   // System.Diagnostics.Debugger.Break();

    if (!Page.IsPostBack)    {

        try        {

           viewName = (base.Request.QueryString.GetValues("View")[0]);                             listName = (base.Request.QueryString.GetValues("List")[0]);

           spWeb = SPControl.GetContextWeb(this.Context);           spList = spWeb.Lists[listName];

           if (spList == null) throw new Exception("list not found");           spView = spList.Views[viewName];           if (spView == null) throw new Exception("View Not Found");

        }        catch (Exception ex)        {

            throw new SPException(ex.Message);        }

    }}

Then in the render method return the relevant xml using some SharePoint API to get the required records and a string builder to construct the XML. You can also create the xml file using System.XML.XMLDocument but I find this way easier to read the XML as I write it.

protected override void  Render(System.Web.UI.HtmlTextWriter writer){     base.Render(writer);

     if (spList != null)     {

         base.Response.AppendHeader("ETag"             , spList.CurrentChangeToken.ToString());         base.Response.AppendHeader("Last-Modified"             , spList.LastItemModifiedDate.ToString("r"             , CultureInfo.InvariantCulture));         base.Response.ContentType = "text/xml";

         if (spView != null)         {             base.Response.ContentEncoding = Encoding.UTF8;

             string channelTitle = "The RSS Channel title";             string channelDescription = "The RSS Description";

             string channelLink = "http://www.chrisforbesblogs.net";             string language = "en-us";             int timeToLive = 60;             string copyright = "Copyright 2009 - "                  + DateTime.Now.Year + " ChrisForbesBlogs.net";

             StringBuilder sb = new StringBuilder();             sb.Append(                 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n");             sb.Append("<rss version=\"2.0\">\r\n");             sb.Append("<channel>\r\n");

             sb.AppendFormat("<title>{0}</title>\r\n"                 , channelTitle);             sb.AppendFormat("<link>{0}</link>\r\n"                 , channelLink);             sb.AppendFormat("<description>{0}</description>\r\n"                 , channelDescription);             sb.AppendFormat("<language>{0}</language>\r\n"                 , language);             sb.AppendFormat("<ttl>{0}</ttl>\r\n", timeToLive);             sb.AppendFormat("<copyright>{0}</copyright>\r\n"                 , copyright);

             string spTitle = "";             string spDescription = "";             string spDate = "";             string spAuthor = "Chris Forbes";

             sb.AppendFormat(                "<lastBuildDate>{0}</lastBuildDate>\r\n"                 , DateTime.Now.Date.ToShortDateString());

             SPListItemCollection items = spList.GetItems(spView);             foreach (SPListItem item in items)             {                 //Make sure you are pulling back valid                 //SharePoint fields which are listed in the view                 if (item["Title"] != null)                     spTitle = item["Title"].ToString();

                 if (item["Description"] != null)                     spTitle = item["Description"].ToString();

                 if (item["PageDate"] != null)                     spTitle = item["PageDate"].ToString();

                 sb.AppendFormat("<item>\r\n");                 sb.AppendFormat("<title>{0}</title>", spTitle);                 sb.AppendFormat("<link><![CDATA[{0}]]></link>\r\n"                     , item.Url);                 sb.AppendFormat(                     "<description><![CDATA[{0}]]></description>\r\n"                     , spDescription);                 sb.AppendFormat("<author>{0}</author>\r\n"                    , spAuthor);                 sb.AppendFormat("<pubDate>{0}</pubDate>\r\n"                    , spDate);                 sb.AppendFormat("</item>\r\n");

             }

             sb.AppendFormat("</channel>\r\n");             sb.AppendFormat("</rss>\r\n");

             base.Response.Write(sb.ToString());         }

     }}

I wrapped the returned field values in <![CDATA[]]> to ensure any illegal characters are ignored by the XML.

As I mentioned earlier you could easily extend this code to use SPQuery instead of relying on an existing view. You could also access a number of lists and aggregate the content into a single feed.

If your publishing this to an anonymous access site then you will have to add some additional methods to prevent an authentication challenge. If you look back the out of the box class file you can see some additional methods which handle this.

 

protected override bool AllowAnonymousAccess

{

get

 

{

return true;

}

}

protected override bool RequireDefaultLayoutsRights

{

get

 

{

return false;

}

}

protected override SPBasePermissions RightsRequired

{

get

 

{

return (SPBasePermissions.EmptyMask | SPBasePermissions.Open);

}

}

Anyway hope the above is of some help to you, happy coding :)

The Managed Metadata Service or Connection is currently not available…

December 2, 2009 1 comment

When you access the ‘Managed Metadata Service’ Management Tool from Central Admin – Manage Service…

image

Click for larger image

You receive the following error…

The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started, Contact your Administrator.

image

Click for larger image

So, obviously I checked the Managed Metadata Service and this was indeed started. So after much troubleshooting and several term store recreations I double checked the SharePoint 2010 Installation guides and spotted that there is now a required WCF hot fix.

After installing this the problem is resolved :)

You can get the hot fix ‘KB976462 – SharePoint Shared Services Roll-ip’ at

http://code.msdn.microsoft.com/KB976462/Release/ProjectReleases.aspx?ReleaseId=3571

 

 

 

 

Problem with User Profile Service in SharePoint 2010

December 1, 2009 Leave a comment

Bit of a random problem but I received the follo wing error across the top of the ‘User Profile Service Application’ page in SharePoint 2010 Beta 2…

imageUser Profile Application’s connection is currently not available. The Application Pool or User Profile Service may not have been started. Please contact your administrator”.

I found the following blog posting from Travis Nielsen who had also received this message and his posting worked for me.

To avoid repeating what Travis has to say read…

http://blogs.pointbridge.com/Blogs/nielsen_travis/Pages/Post.aspx?_ID=30

Travis talked about commenting out  the allowinsecuretransport attribute This is what the commented out section of the client.config file looked like for me. Note there are two references to this, so I commented out both.

 

image 

After you have made the change remember to do an IISRESET.

 

 

Categories: SharePoint 2010
Follow

Get every new post delivered to your Inbox.