Nick Grattan’s SharePoint Blog

About Microsoft SharePoint and some .NET

SharePoint 2010 – Provisioning User Profile Synchronization

leave a comment »

Configuring AD synchronization with SharePoint 2010 can be problematic. Here’s a great post on how to configure the services, including ForeFront Identity Manager:

http://blogs.msdn.com/b/russmax/archive/2010/03/20/sharepoint-2010-provisioning-user-profile-synchronization.aspx

Written by Nick Grattan

November 3, 2011 at 9:12 am

SharePoint 2010 Foundation, Server Service Pack 1 for Download

leave a comment »

Here’s information on SP1 for SharePoint 2010 Foundation http://support.microsoft.com/kb/2460058. Download from here: http://www.microsoft.com/download/en/details.aspx?id=26640

And for SP1 for SharePoint Server (Enterprise and Standard) information http://support.microsoft.com/kb/2460045. Download from: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=26623

 

Written by Nick Grattan

July 1, 2011 at 12:53 pm

SharePoint Diagnostic Studio

leave a comment »

Talking of tools (see Favorite SharePoint Development Tools), the SharePoint Diagnostic Studio from Microsoft provides SharePoint performance monitoring functionality. This tool is particularly useful for consolidating the ULS records across servers in a SharePoint server farm. It’s part of the Microsoft SharePoint 2010 Administration Toolkit v2.0.

While useful, the user interface is not particularly polished or easy to use. In particular, the SharePoint Diagnostic Studio must be run with the language set to “US-English”, otherwise date formats will be presented incorrectly and date/time filtering will not work.

Overall Description: http://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=971

Download from: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=718447d8-0814-427a-81c3-c9c3d84c456e&displaylang=en

Documentation: http://technet.microsoft.com/en-us/library/hh144782.aspx

Written by Nick Grattan

July 1, 2011 at 12:41 pm

Favorite SharePoint Development Tools?

with 4 comments

Here’s a four free development tools you shouldn’t start a SharePoint development project without:

For uploading single or groups of files from the desktop or mail messages from Outlook I use, of course, our “SPDrag&Drop” tool. Take a trial by downloading from here: http://www.nickgrattan.net/SPDragDrop/ProductInfo.aspx

Written by Nick Grattan

June 30, 2011 at 1:06 pm

Opening Web Parts Gallery Programmatically

leave a comment »

Navigating to the Web Part Gallery in the browser interface takes you to http://site collection URL/_layouts/_catalogs/wp/Forms/AllItems.aspx. Attempting to open the list through “_catalogs/wp” will fail:


SPList spWPG = spWeb.Lists["_catalogs/wp"];  // does not work

 Instead, you need to use the following code:


SPList spWPG = spWeb.Lists["Web Part Gallery"];

Reference: http://meiyinglim.blogspot.com/2007/10/programatically-organizing-web-parts-in.html

Written by Nick Grattan

June 23, 2011 at 12:21 pm

SharePoint Global Resource (resx) file locations

with one comment

Global resource (resx) files are stored in the following locations in SharePoint 2010:

  • App_GlobalResources folder in the VirtualDirectories folder in inetpub (e.g. C:\inetpub\wwwroot\wss\VirtualDirectories\80)
  • Resources folder in the 14 hive (e.g. C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Resources)
  • Config/Resources folder in the 14 hive (e.g. C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\Resources)

In general, a single resx file in your solution should be copied into each of these locations during installation.  This is how they are used:

  • Resources files in App_GlobalResources are used when code in an ASPX page refers to a resource, e.g.


<asp:Label ID="lblNumberingTitle" runat="server" Text="<%$Resources:GlobalSiteResources, AutoNameTitle %>" />

  • Resources files in the Resources folder are used when referencing resources using the SharePoint object model, e.g.


btnExport.Text = SPUtility.GetLocalizedString("$Resources:GlobalSiteResources, Tab_Export", "GloablSiteResources", language);

  • Resources files in the Config/Resources are copied into the App_GlobalResources folder whenever a new web application is created. By adding the resx files here you will ensure your application will be able to access its global resource files in new web applications.

Written by Nick Grattan

May 24, 2011 at 12:53 pm

Chart Web Part: Hiding “Data & Appearance” and “Advanced Properties”

with 5 comments

The “Chart Web Part” shipped with SharePoint 2010 does a reasonable job of displaying graphs. However, when added to a web part page, it displays “Data & Appearance” and “Advanced Properties” links which can be annoying:

The links cannot be hidden through the web part configuration user interface. Instead you need to:

  1. Open the ASPX page in Microsoft SharePoint Designer 2010.
  2. Locate the Chart Web Part in Code View.
  3. Edit the ShowToolbar property from “True” to “False”.
  4. Save changes.

Now these links will be hidden. You can use the standard drop down web part menu to access them if you need to without re-enabling them:

Written by Nick Grattan

February 15, 2011 at 7:40 pm

Restore Error: Path cannot be used at this time

leave a comment »

When performing a Microsoft SharePoint 2007 restore you may receive this error:

Object NG_Documents (previous name: Documents) failed in event OnRestore. For more information, see the error log located in the backup directory.

COMException: The path specified cannot be used at this time. (Exception from HRESULT: 0×80070094)

To fix this problem you may need to apply this hot fix: http://support.microsoft.com/kb/946517

Note that this is a hotfix that is applied to Microsoft Windows Server and not to SharePoint itself.

Written by Nick Grattan

January 7, 2011 at 1:17 pm

SharePoint: Opening CSV files with Microsoft Excel

with one comment

By default, if open a .CSV file in a SharePoint the browser will prompt you to save the file. Ideally, you probably want the file to be opened directly in Microsoft Excel. There are two configuration options that need to be made. The instructions here are for SharePoint 2010 but are similar for SharePoint 2007.

  • Add an entry to DOCICON.XML

This file is located by default at: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML. Open the file DOCICON.XML for editing and add the following line in the ByExtension element:

        <Mapping Key=”csv” Value=”icxltx.png” OpenControl=”"/>

This ensures that the Excel icon is displayed alongside CSV files.

Note: if you want to be prompted to open read-only or for edit remove ‘OpenControl=”" ‘ in the Mapping Key.

  • Change the MIME type associated with the CSV Extension in Internet Information Server (IIS)

To do this:

  1. Run the “Internet Information Services (IIS) Manager” application from the Start/Administrative tools menu.
  2. Select the server in the left-hand pane.
  3. Select “MIME Types” in the list of options in the middle pane.
  4. Then locate the .CSV entry (it should already exist) and change the MIME type to: application/vnd.ms-excel, and click OK.

Once these configuration options are complete perform an IIS Reset.

CSV files should now be opened using Excel by default. You will be prompted that a change in file extension has occurred when using Office 2007. You will need to click Yes in this warning message.

Written by Nick Grattan

January 5, 2011 at 9:11 am

When a SPFieldUserValueCollection won’t clear

leave a comment »

Some time ago I wrote about problems with updating items through an item collection (see here). Well, here’s another similar problem that has bitten me, and it’s to do with updating a SPFieldUserValueCollection object.

In this code I want to clear out the list of users configured for a multi-select user column in a list:

                SPListItem li = ...; // get a list item
                SPFieldUserValueCollection uvc = (SPFieldUserValueCollection)li["View Form Groups"];
                if (uvc != null)
                {
                    uvc.Clear();
                }
                li.Update();

The code gets the SPFieldUserValueCollection object for the field, and if it’s not null, empties the collection and updates the item.

However, the list of users is not cleared in the list item. It seems that a copy of the collection is made, and it’s the copy that is cleared. Here’s the code to correct this problem:

                SPListItem li = ...;
                SPFieldUserValueCollection uvc = (SPFieldUserValueCollection)li["View Form Groups"];
                if (uvc != null)
                {
                    uvc.Clear();
                    li["View Form Groups"] = uvc;
                }
                li.Update();

In this case, the modified SPFieldUserValueCollection is copied back into the field and the list item updated.

Written by Nick Grattan

January 2, 2011 at 9:58 am

Follow

Get every new post delivered to your Inbox.