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

Wednesday, October 21, 2009

Error when opening a list in Datasheet View

“Access web datasheet is attempting to retrieve data from a different domain…”

When seeing this error message I first thought of cross domain access using JavaScript.

By checking the field types of the dropdowns that did fail I discovered that the only fields that failed was lookup fields that uses other tables as data source, other dropdown menus that where static worked fine. The lookup fields returned blank in datasheet view, but worked  in a normal list view.

By examining the links that the site presented I saw a combination of links pointing to different server names. ex: the user entered intranet in the address field in the browser and some links where pointing to the server name (Without the domain suffix or zone)

The problem: Alternate Access Mappings were not configured for the alias intranet. Therefore the server returned different links. And to my understanding this was the case for the error message, and the empty lookups.

The Solution: Add a internal URL in the Access Mappings located in the SharePoint Central Administration->Operations->Global Settings->Alternate Access Mappings that points to the alias (intranet)

After adding a new url to the access mappings the datasheet view returned correct values in the lookup fields.

Thursday, September 24, 2009

Can not enable anonymous access for internet zone

Just to clarify the relationship between alternate access mappings host headers and SharePoint Zones…

While configuring multiple frontend servers and different zones, including Internet. I discovered that I could not set the anonymous access to my site in the Internet Zone.

What puzzled me was the fact that I could not set the anonymous access rights on the site after enabling anonymous in the Zone. The choices were all disabled. (_layouts/setanon.aspx)

Not_Anon

Not having my mind correctly set I missed the fact that I was configuring the site collection using a url that was NOT configured for the Internet zone. I was only configuring using the default zone (or the server name as host to be specific)

The host header and the alternate access mappings is the only link that SharePoint has to discover that the site actually is in a zone. It all makes sense, but when you are configuring your site before the DNS entries are set you may stumble on this little problem…

By using the correct hostname, that is referring to the internet zone in my browser it all worked out.

OK_Anon

Tuesday, September 22, 2009

ASP.NET error after installing a SharePoint WFE

After installing a new SharePoint Web Frontend you  receive a “normal” ASP.NET error message the address in the browser will point to the _Layouts “directory”, so SharePoint is in play.

When studying the event log the message contains “Could not load file or assembly RSSharePointSoapProxy…

This is a Assembly that is used by the SQL Server Reporting Services Integration for SharePoint.

The problem: Reporting Services is installed on the SharePoint Farm and the binaries does not exist on the new frontend server.

Solution:

Start by downloading the Microsoft SQL Server Reporting Services Add-in for Microsoft SharePoint Technologies for SQL 2005 or SQL 2008 (May 2009 release) (SharePointRS.msi or RSSharePoint.msi)

Note: The description below is based on the 2008 version of the Add-in

Do not run the MSI as a ordinary setup process, this will result in a error message in the event log and a rollback of the package. The error indicates that the SERVERNAME$ can not logon to the database.

Start the MSI with the parameter SKIPCA=1 this will extract the file rsCustomAction.exe to the TEMP folder of the current user.

To install the binaries and configure the Reporting Services run rsCustomAction.exe /i

Be sure to run as a user that has rights to the SharePoint Site Collection.

After the executable finishes your new SharePoint Front End should display the SharePoint sites normally.

By running this application the Solution will be redeployed on the existing servers as well, even upgraded if possible.

For more information see the readme bundled with the Add-in

Access denied when configuring SharePoint WFE

When adding a new Web Front End Server to a SharePoint Farm you may get a access denied error in step 2 when connection to the configuration database. This error will occur regardless of the configuration entered before the configuration begins. (The search for configuration database is successful.)

Configuring_SharePoint

Before starting SQL Management Studio or another tool to check permissions on your database server. Check the version of the existing SharePoint environment.

You will get this error if the new SharePoint server binaries is another version than the existing system. Remember to update the SharePoint installation (Both WSS and MOSS) before running the SharePoint Products and Technology Configuration Wizard.

Refer to the SharePoint AdminWiki to get your SharePoint Version.

Monday, August 24, 2009

Error when configuring SharePoint Services Search Service

You probably know this already this is just a notice to self :-)

When configuring a SharePoint Services Server running everything locally you normally specify the user accounts only by the username during the installation and configuration.

When looking at the Services in the server you notice that there is one service that is not starting. The “Search Service”. You click on the start link and the configuration page pops up. You enter all the user settings and click on start. After a second or two a rather generic error message appears SPSearch(Username).

After rechecking passwords and usernames you try again, with the same result…

The problem is that the “Service Account” username must have domain\user or server\user syntax (server\user in this case)

The “Content Access” Account can be specified using the username only (But it does not hurt to add the server name as well)

Search_Service_Account

Thursday, August 6, 2009

Change a users property in Active Directory

In order to change a users property you must get the DirectoryEntry for the user. Below are some simple code that I have been using in my “AD import Tool”

GetUser – Returns a DirectoryEntry that can be used to get and set properties for a user object i AD (Click for a larger image, code is at the end of the post)

GetUser Example

The function used in a wrapper class along with other code mainly gathered in the Howto: (Almost) Everything In Active Directory via C# at CodeProject.

 

ADHelper GetUser Example

You can download the ADHelper class here

Note: This is a only a simple example. It has not been tested thoroughly for memory leaks.

Can not find property “mobile” in Active Directory

While developing an application used to import mobile phone numbers from a CSV file to Active Directory I discovered that the attribute “mobile” did not exist for users where this property never had been used before (Never been updated by other tools such as the Active directory MMC snap-in etc.)

The application uses the standard System.DirectoryServices.ActiveDirectory assembly shipped with .NET 2.0. (See the article on CodeProject Howto: (Almost) Everything In Active Directory via C# for more code)

mobile

The source code after gathered the Directory Entry for a user. Is used to update the mobile attribute:

mobile

Do not forget to CommitChanges, Close and Dispose…

Friday, July 31, 2009

Tweaking the Quicklaunch menu with JQuery

The standard Quicklaunch menu or the <SharePoint:AspMenu> has some limitations regarding layout and dynamic display… Microsoft has released the code to the menu in order to make the menu more customizable (The reason for the publication of the source code is the the fact that the control is marked as sealed and is therefore not eligible to be used as the base class for derived types.) Read my other post on how to use this code to highlight the selected menu items.

When using a WSS environment the menu has further limitations regarding the url of a root element. The “problem” is that all menu items must have a url. The easy fix for this is to make all your level one URL’s like “/#” This will result in a link to the same page, but there will be a postback when a user clicks on the link.

In some scenarios you do not want, or you can not modify SharePoint using Features and compiled code.

So how do we modify the menu without writing any C# code? We use the JQuery library to parse and tweak the HTML already generated by the aspmenu control

The main part of the JQuery code is made by Paul Grenier and filed at EnduserSharePoint.com. Be sure to check out the other JQuery and SharePoint related articles!

The solution looks like this when finished

JQuery_Menu

To make the menu look like this I used one JavaScript library, a modified CSS file and a modified Masterpage. The masterpage modifications is minor and not a part of the dynamic experience…

The masterpage was modified to link to the two java libraries used, one for the JQuery library and one for the script from Paul Grenier.

linking_JQuery

I have modified the script a little in order to make the empty headers act as you clicked on +/- (The modifications are simple and can surely be made better, but it is my first JQuery Code)

JQueryMod

When a link is modified in SharePoint Services and the address is /#! the link will not behave like a normal link but expand/collapse instead.

jquery_empty_link

This was a big eye opener and definitely my start down the “JQuery Lane” It is so much you can do with so little code…

The files used can be downloaded here

Wednesday, July 1, 2009

You can now hear the content of this blog

I have embedded the ReadSpeaker service on this blog. The Free ReadSpeaker WebReader will make the content more available for users with some form of reading disability.

Just click on the Listen button on every post to make the “web speak”

ReadSpeaker logo

 

 

 

 

 

Check out the ReadSpeaker website for more information.

Problem with two domains automatically authenticating

After joining two domains I discovered that only users from one domain where automatically logged on to SharePoint. After checking with Google I tried to give the users Access using the Built-in groups, and changing the web application policy. I even checked the possibility to create different zones etc.

The two domains trust each other, and the users in one domain is included in a domain group in the “source domain”. So theoretically this should work…

After checking nearly all settings in SharePoint I took a look at the client, Internet Explorer. Since all settings in IIS and SharePoint looked OK, I figured that it may be the client.

After configuring the SharePoint URL as a trusted site, and changing the User Authentication in IE the problem was solved.

twodomains_001

Thinking about the problem, and the simple solution I found that always starting the problem solving at the server end may result in many hours of headache. Next time I will check the client configuration…

To configure the “Automatic logon with current user name and password” Choose Tools->Internet Options, Security Tab, and click on the “Custom Level” button. Scroll down to the bottom of the settings list.

This can easily be distributed with a GPO, and for my lesson learned, I always check for the sites to be a trusted site, or in the local intranet zone before checking the server configuration.

Tuesday, June 23, 2009

GetListItems only returns 100 items

When using the SharePoint webservice lists.asmx you can create a simple CAML query to retrieve listitems. I discovered that when no RowLimit is set the result does not return more than 100 items. So if you want to retrieve more than 100 items be sure to specify the RowLimit when calling GetListItems.

The example below is in Delphi code:

GetListItems

The code above will return all items using a max limit of 5000 items. The code below will only return 100 items regardless of the “real” amount of list items specified.

GetListItems_1

Monday, June 15, 2009

Do not forget the <Query> in your Queries

When programming using the SharePoint WebServices you often want to write a CAML query to select items from a list etc.

When developing using the SharePoint API you do not need to write the surrounding <Query> tags. But when you submit a query to a webservice ex: lists.asmx the tags must be present.

Without the query tags the response will contain a soap exception.

It took me a while figuring this out as I was copying some C# code from an evenhandler to select items, into a Delphi app consuming the Lists webservice.

query

Saturday, May 9, 2009

Detect if PIA 2007 is installed on a computer

Distributing applications that uses the Redistributable Primary Interop Assemblies for the 2007 Microsoft Office System. Can be a challenge. A article on MSDN written by Wouter van Vugt and Ted Pattison Deploying a Visual Studio Tools for the Office System 3.0… really helped me along…

I am using Setup Factory by Indigo Rose to create my MSI package. During the initial setup I can define various launch conditions for my MSI. The launch conditions are defined by the results returned from searching for files, registry entries, components etc.

As described in the article mentioned above I am checking for the component identifier for the product that my deployed application is dependent on. In my case MS Outlook 2007.

Outlook Component ID

This will successfully detect if Outlook 2007 PIA is installed on the system. But when I removed Office 2007 PIA from the system (Not a reboot) The component search still returned true (The location in the GAC). So to modify the launch condition query I also added a folder search in the Installer directory.

Outlook Folder ID

So my launch condition for the MSI that is dependent on the Office 2007 PIA checks the presence of the installer files from the PIA MSI and the Component ID of the Outlook PIA to make sure that Outlook PIA is installed on the system.

Launch conditions

Wednesday, February 18, 2009

Show document icon using XSL and DDWRT


When displaying a document icon using XSL you may have tried to just map the image from the /_layouts/images folder using the file extension. This will work in most cases but it will not map PDF files etc. unless you add the images or edit the file mappings.

The ddwrt library has just this function made for you:

include a reference to the library in your xslt:

xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"

This is a snippet that includes the icon and sets the correct icon if the “file” is a folder:

<a href="{@FileRef}">
<xsl:choose>
<xsl:when test="@FSObjType=1"> <!-- Folder -->
<img alt="{@Title}" src="/_layouts/images/folder.gif" style="vertical-align: middle;border:none;"/>
</xsl:when>
<xsl:otherwise>
<img alt="{@Title}" src="/_layouts/images/{ddwrt:MapToIcon('', string(@File_x0020_Type))}" style="vertical-align: middle;border:none;"/>
</xsl:otherwise>
</xsl:choose>
</a>




Folders presented in xsl 

Tuesday, February 10, 2009

Error saving files in SharePoint

When uploading a file to SharePoint a message like “Unable to complete this operation. Please contact your administrator. at Microsoft.SharePoint.Library.SPRequestInternalClass.PutFile(String bstrUrl…” is presented.

The first thought that comes into mind is file size, illegal file types or rights.

But in this case the problem was 0 kb. free on the database server data disk!

So keep in mind that this message can indicate a problem with the space allocated to the Content database, and not necessarily a problem with the configuration.

The problem was solved by detaching the content database, moving it to another disk, truncating the log and attaching it again.

Note: This problem should have been avoided by monitoring disk- or database space.

Thursday, February 5, 2009

String.EndsWith and String.Empty

During a debugging session trying to find out why my a simple test to check a email address against a domain failed I discovered that String.EndsWith will return true if you try to compare a string and a empty string.

In my case I was checking list items with the format @domain.com against a valid e-mail address. But the function always returned the default choice. A “Please Choose” item with no domain configured. (A empty string)

In order to fix the problem I just added an if test to see if the string was empty and then ignored the EndsWith test.

Endswith 

This should have been a regular expression, but it works for now :-)

Monday, January 12, 2009

Get the Site ID in an event handler (SPItemEventReceiver)

While creating an event receiver for a list that is used to replicate project status I discovered that the SPItemEventProperties did not return what I expected.

I use the SiteID to recognize the list item when doing a update. The receiving list should only have one list item (status) for each reporting project site. To identify the site I was planning to use the property SiteId

SiteID

After reporting the status from two different sites I discovered that the receiving list only contained one list item. It should have contained two, one for each site.

Some more research discovered that the siteId is the ID of the root site, not the site where the event occurred.

Needing the SiteID of the site where the event occurred I tried using the OpenWeb() function instead

WebSiteID

The ID returned what I needed, and the event receiver reported successfully status for each subsite. I guess this just adds one more situation where you can get a little confused in the use of the terms site and web in SharePoint