Tuesday, November 2, 2010

IsDlg=1 numeric value is not validated

When using SP.UI.ModalDialog.showModalDialog(…) you should set the parameter IsDlg to 1 when calling a List Form (View/Edit/Create) this removes all references to masterpage items such as quick launch etc.

Keep in mind that the numeric value entered after the IsDlg has no effect, so setting IsDlg=0 is the same as IsDlg=1 SharePoint only checks for the existence of the variable IsDlg and does not check if the value is set to anything. So leave out the IsDlg entirely when the page is loaded without popup windows

Thursday, September 30, 2010

disable-output-escaping="yes" on People or Group Column

When creating a custom List Form from SharePoint Designer 2010 the People or Group field/columns ends up being displayed as HTML code instead of the field value

PID

To get fieldtypes that renders as HTML to display correctly just add the parameter disable-output-escaping="yes" to the value-of select:

EscapeYes

This will display the People or Group field with the correct link to the person.

Friday, July 30, 2010

Error when connecting VS2008 to TFS2010

When connecting Visual Studio 2008 to TFS2010 you must have the following update installed “Visual Studio Team System 2008 Forward Compatibility Update for Team Foundation Server 2010 interoperability

If you are using “Local Database Cache functionality in Smart
Device projects” the “Microsoft Synchronization Services for ADO.NET 1.0 for Devices” must also be installed.

The Visual Studio 2008 SP1 is a required prerequisite to install the above updates.

After installing you must use the complete Url to the TFS2010 Server, and leave out the trailing slash. if the URL contans a trailing slash a message “Unable to switch servers at this time. Team Explorer is busy.” will appear several times. And end in a dialog box  with the message “Error in the application”

Add 2010 Server with 2008 Client

For more information about the limitations of a 2008 client with a 2010 server see “Compatible Matrix for 2010 RTM Team Foundation Server to Team Explorer 2008 and 2005

Wednesday, July 28, 2010

Connecting to TFS2010 from a Webpart

With the implementation of Team Foundation Server 2010 the need for some integration with SharePoint 2010 was needed. Just to test the TFS API a simple webpart for registration of User Stories from SharePoint was created.

New to the TFS API I discovered that connection to the Project Collection needed a ICredentialsProvider (Fallback).  The UICredentialsProvider works fine in Windows Applications but when using the web, this provider can not be used…

The first step is to create a new Interface that uses the NetworkCredential class to return the credentials

public class NetworkCredentialsProvider : ICredentialsProvider
    {
        private readonly NetworkCredential credentials;
        public NetworkCredentialsProvider(NetworkCredential credentials)
        {
            this.credentials = credentials;
        }
        public ICredentials GetCredentials(Uri uri, ICredentials failedCredentials)
        {
            return this.credentials;
        }
        public void NotifyCredentialsAuthenticated(Uri uri)
        {
        }
    }

Use this Provider to connect to the Project Collection

ICredentialsProvider TFSProxyCredentials;
var credentials = new NetworkCredential("Username", "Password", "Domain"); TFSProxyCredentials = new NetworkCredentialsProvider(credentials);

var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(projectCollectionUri, TFSProxyCredentials);

When running this code from a webpage/webpart the TFS will return an exception: “TF237121: Cannot complete the operation. An unexpected error occurred.”

This Exception is occurs because the TFS Client does not have a reference to a local Cache for storing files. (Normally this is stored in the current user profile area)

The solution is to let the TFS Client know where to store cache-files. This is done by defining a application setting named WorkItemTrackingCacheRoot and specifying a local path on the server (With proper NTFS rights)

The application setting can be created in web.config or programmatically

web.config:

<appSettings> <!-- Add reference to TFS Client Cache -->
   <
add key="WorkItemTrackingCacheRoot" value="C:\TFSClientCache"
/> </appSettings>

Code:

if (WebConfigurationManager.AppSettings["WorkItemTrackingCacheRoot"] == null || WebConfigurationManager.AppSettings["WorkItemTrackingCacheRoot"] == String.Empty)
{
   WebConfigurationManager.AppSettings["WorkItemTrackingCacheRoot"] = System.IO.Path.GetTempPath() + "TFSClientCache";
}

Thanks to Naren’s blog for pointing out the Client Cache settings

Click to download complete code to connect, and to get project info

 

Friday, April 30, 2010

Get the value of PeoplePicker during postback

Using the People Picker Field in a custom listform is basically straight forward. But I ran into a little problem when I needed to extend the validation of the form based on the user specified in the field:

ResolvedEntities[] vs. Entities[]

I needed to run a CAML Query and use the username as a parameter but the property Entities did not contain any objects during postback.

Solution use the ResolvedEntities instead, this contains the users that have been validated and is persistent during postback…

if (Pe_EffectiveUser.ResolvedEntities.Count != 0)
{

PickerEntity PEffectiveUser = (PickerEntity)Pe_EffectiveUser.ResolvedEntities[0];
//PickerEntity PEffectiveUser = (PickerEntity)Pe_EffectiveUser.Entities[0];
this.EffectiveUser = PEffectiveUser.Description;

String UserID = this.EffectiveUser.Substring(this.EffectiveUser.IndexOf("\\") + 1);
}
else
{
// Show a button to validate before continuing
}
 

Friday, October 30, 2009

SharePoint Indexing - mssdmn.exe is using 100% CPU

After experiencing a slow SharePoint system it was discovered that the process mssdmn.exe was consuming all available CPU. (Frontend and Indexing service on same server)

SharePoint indexing was correctly configured, and performance configured not to use all CPU…

The resolution in this case was to install the latest IFilters for Office from Microsoft and the latest IFilter for Adobe PDF from Adobe (Version 8 and 9 has also support for for 64-bit systems)

Note: To compare Foxit and Adobe see the “Jie Li's GeekWorld (BLOG)

After installing the filters, and changing the ObjectID in registry for PDF files (See documentation at Adobe (Page 2)) The process started indexing, and stopped consuming CPU after the indexing tasks were finished…

No need to restart the server, just restart the Search Service and the IIS

  • net stop ossearch –> net start ossearch
  • iisreset /noforce

Monday, October 26, 2009

Reminder – Disable Loopback Check

Posting this to remind me that this has to be done to successfully debug SharePoint locally…

When running IIS and logging on locally to a site that uses Integrated Security (Most SharePoint installations do) You must logon to the site.

This is a security feature that is designed to help prevent reflection attacks on your computer. Therefore, authentication fails if the FQDN or the custom host header that you use does not match the local computer name.

To disable this feature you must edit Registry (Windows 2008 Server) or you can use a Microsoft Utility (Fix it) (Currently the Fix it application does not run on Windows 2008 R2)

Read more at Microsoft (You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or a later version)

Using Regedit:

DisableLoopbackCheck

Insert a DWORD Value named DisableLoopbackCheck and set the value to 1

DisableLoopbackCheck