The circle of life – ** .Net – Training – MOSS **

  • Past Post

  • Vistor Locations

  • Advertisements

SharePoint Authentication: FireFoxs works but IE doesn’t

Posted by Clayton James on May 20, 2009

I was having a great deal of pain on a new SharePoint development server recently. Environment = Windows 2008, IE7.


  1. Create a SharePoint web application with a host header on port 80. Create a site collection
  2. Update host file (or DNS) with new host header entry
  3. In IE make sure the web application is in the Intranet Zone
  4. Open up browser in IE navigate to site using host header and the authentication dialog login is displayed.
  5. Enter my credentials 3 times and receive a 401.1 and an entry in the Security Event log
  6. If I open FireFox and browse to the web site the authentication dialog is displayed
  7. I enter my credentials and I can log in fine
    Note: To get rid of the authentication prompt in FireFox
    1. Open FireFox and in the address type about:config
    2. Find the entry network.automatic-ntlm-auth.trusted-uris
    3. Set the Key’s value to a comma seperated list of trusted URIs i.e your host header
  8. So FireFox is fine but IE is having issues



I finally stumbled across a blog article from Brian Farnhill and Ishai Sagi that lead me to the solution.

You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or IIS 6

In my case I am using IE 7 and while the Solution/Workaround discusses two separate methods and states that method one is preferred, I could only fix my issue upon completing method 2


Posted in MOSS 2007, Office 12, WSS 3.0 | 3 Comments »

Accessibility Resources

Posted by Clayton James on May 15, 2009

A list of useful accessibility resources

Microsoft ASP.Net

SharePoint Specific


Posted in .NET 2.0 | 1 Comment »

Importing AD Employee Photos into SharePoint User Profiles

Posted by Clayton James on May 8, 2009

I was recently asked to provide a process for importing Employee pictures into SharePoint so they would show up in search results and various OOTB web parts. This particular client has MOSS but doesn’t use My Sites.

This post by Henry initially helped me out.

They didn’t want the individual users to have the abilty to upload their own photo’s or modify them in any way, this was to be managed by IT.

  1. Create a Picture Library in your Intranet. This will store the photo’s for each employee. When storing employee photo’s chose the filename carefully if you want to populate the AD using scripts. I use something like cjames.jpg which is a correlation to the users account name.
  2. In Active Directory choose an AD property that will be mapped to your SharePoint User Profile Property. In my case I selected the extensionAttribute1 field that is located in the ExchangedAdvanced tab ((note this field may not show up if the Exchange Mgt Console hasn’t been installed)
  3. Populate this field with the URL to the employee’s photo that is in the Picture Library e.g http://sitename/ProfilePhotos/CJames.jpg (look below for a script example)
  4. In SharePoint SSP click the User Profiles and Properties link
  5. Click the View Profile Properties under the heading User Profile Properties
  6. Find the Picture property and select the Edit menu item
  7. Make note of the Usage: Number of profiles using this property. This should increase after we complete a full import
  8. At the bottom of the screen make sure Master Connection is selected and in the Datasource field to map select extensionAttribute1 (note: this field may not show up if the Exchange Mgt Console hasn’t been installed)
  9. Click Ok
  10. Complete a StartFull Import
  11. Once the full import is complete go back into the the Picture property and again check the Usage:Number of profiles that use this property. This should now contain some values.
  12. Verify this by viewing an Employee’s profile and the Picture property

Some things I had issues with:

  • Make sure your Import Connection service account has “Manage User Profile” permissions
  • May need to execute a Full Search crawl once photos are uploaded in the Picture Library

I also wrote a script to populate the AD extensionAttribute1 field as there were over 1000 employee’s and no one put their hand up for this job. The import thing here was for employee photo images to have a one to one mapping with their login account name (samaccountname). The person who runs this script also needs certain permissions in AD to update AD accounts. I would initially comment out the On Error Resume Next so you see if your account has enough privleges or not.

The script is very limited but hopefully it may provide some insight.

‘On Error Resume Next
Set objParent = GetObject(“LDAP://OU=Users,OU=Austraila,OU=Offices,OU=AU,DC=domain,DC=local“)
objparent.Filter = Array(“user”)
for each objUser in objParent
  Wscript.Echo “Modifying ” & objUser.Get(“samaccountname”) 
  objUser.put “extensionAttribute1”, “http://sitename/ProfilePhotos/” & objUser.Get(“samaccountname”) & “.jpg”

Wscript.Echo “End”

Now, IT are responsible whenever they create a new account they must also populate the extensionAttribute1 field with the URL of the picture library and the employee’s picture filename will always be their account name.

Posted in MOSS 2007, Office 12 | 207 Comments »

Sign in as a Different User

Posted by Clayton James on May 7, 2009

This little feature has caused myself so many problems for different clients. Some of the main issues I have come across include:

  • Still runs .Net code under the person who has logged into the computer
  • Creates authentication issues for end users when trying to open an Intranet bowser. Have to remove their user profiles to fix

I recommend to anyone now to find the IExplore.exe (right click your shortcut and select Properties, then click the  “Find Target” button), right click and select the “run as”. Enter the credentials of the user you wish to log in as.

This still won’t run .Net code under the new credentials you have entered but I have not come across any authentication issues using this approach so far.

Posted in WSS 3.0 | 1 Comment »

Non-Admins View Site Usage Reports

Posted by Clayton James on May 5, 2009

How to get non-admins to view your site collection and site usage reports

Site Collection Admins or user will Full Control can view Site Collection and Site Usage Reports.  So if you want other users to access these reports you can do the following:

  1. Create a custom site permission level and select the “View Usage Data” check box
    Note: this will also select the “View Pages” permission
  2. Create a new Group called something like “Usage Report Viewers” and assign the permission level you created above to the group
  3. Add the people you want to view the reports
  4. Provide the users with links to the report pages
    1/ http://sitecollection/_layouts/SpUsageSite.aspx – view site collection reports
    2/ http://sitecollection/_layouts/SpUsageWeb.aspx – view site reports

Use a web part to display the links and above and audience targeting so only the users in the SharePoint group “Usage Report Viewers” see the web part.

Posted in WSS 3.0 | 6 Comments »

Handling.Net DataSets correctly

Posted by Clayton James on March 18, 2009

One of the most common programming issues I see when working at clients locations is the way the common .Net DataSet is managed. I see a lot of code written like the first example below which checks if the DataSet table contains any rows. The problem with Example 1 is it expects a couple of things. Firstly that a DataSet (ds) even exists and secondly that it also contains a table. This code will throw an exception if the DataSet is null or no DataSet table exists.

Example 1
//this will throw an exception if ds is null or no table exists
if(ds.Tables[0].Rows.Count > 0)
            //process data

Example 2
So you should write your code checking of empty rows, empty tables and if the DataSet object exists.
if(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            //process data
         // it is empty


Happy Coding! 🙂

Posted in .NET 2.0 | Leave a Comment »

IFrame Resize and SharePoint

Posted by Clayton James on March 3, 2009

I created a custom IFrame web part that has a dynamic source property. The client wanted the IFrame to dynamically resize itself to the browsers width and height.


To achieve this we needed to place the web part directly into the page i.e don’t use a webpart zone. A web part zone wraps tables around the IFrame and controls the width and height properties.


I read a few articles about using JQuery….may have to give this a go also.

Posted in .NET 2.0 | 1 Comment »

User Group Presentation

Posted by Clayton James on February 17, 2009

I will be presenting at my local SharePoint user group tomorrow. This will actually be my first SharePoint user group presentation so I am really looking forward to meeting some new people and seeing what is happening in the SharePoint space.

I am talking about the Content Query Web Part and the abstract is below.

Leveraging the Content Query Web Part

Come and learn how to configure one of the most important MOSS web parts in your toolkit. We will walk-through SharePoint’s premier OOTB rollup web part and demonstrate how to display results in 2 or 3 column format and have multiple fields returned in the results. We will also open Visual Studio and demonstrate how to extend its functionality with paging and dynamic filtering.


If you would like to attend then the details are below.


Posted in .NET 2.0 | 1 Comment »

CAS & Web Parts

Posted by Clayton James on January 10, 2009

Brett Lonsdale has done some great work in documenting CAS in SharePoint. I recently used two of his articles to get my assemblies working.




The CAS Bible – old but still very relevant


Great work from Patrick about grouping assemblies to share CAS policies using the same .snk file.


Good explanation

Posted in .NET 2.0 | 2 Comments »

SharePoint December Cumulative Updates

Posted by Clayton James on January 9, 2009

I have just updated my development (Single Server with SQL Server installed) SharePoint machine with the WSS and MOSS December updates. Note there are two updates if you are running MOSS.

To my surprise everything worked a treat.

I only had SP1 installed before I installed the December updates. I didn’t have the Infrastructure update or any other hotfixes installed before applying the updates.


  1. I installed the WSS update first.
  2. I didn’t run SharePoint Configuration wizard
  3. I installed the MOSS update
  4. I did run the SharePoint Configuration wizard


The great thing about the December update is that it includes all previous hotfixes from RTM.

Read and download them from here.

Posted in .NET 2.0 | Leave a Comment »

How to add a webpart into a special group other than miscellaneous

Posted by Clayton James on January 8, 2009

By default, SharePoint web parts are always put into a web part group called “Miscellaneous”.

If you want to automate this process when deploying your web parts as a Feature you can do the following:

In your web parts element manifest file

    <ElementManifest Location=”MyWebPart\MyWebPart.xml” /> this is the file you edit
    <ElementFile Location=”MyWebPart\MyWebPart.webpart” />


Add the following elements

<Module Name=”WebParts” List=”113″ Url=”_catalogs/wp”>
      <File Path=”FlarePoint.MyWebPart.webpart” Url=”FlarePoint.MyWebPart.webpart” Type=”GhostableInLibrary”>
          <Property Name=”Group” Value=”FlarePoint Web Parts” />this is what you add for the Group
          <Property Name=”Title” Value=”FlarePoint.MyWebPart” />this is what you add for the Title
          <Property Name=”WebPartDescription” Value=”FlarePoints MyWebPart description” />this is what you add for the Description

Good post on doing this via the object model

Posted in .NET 2.0 | 12 Comments »

DataView vs DataForm

Posted by Clayton James on January 6, 2009

I was looking into the differences between the DataViewWebPart and the DataFormWebPart today and I found little information on this topic until I finally came across a SPD blog entry:


Data View vs. Data Form

Before we go deeper, you may have noticed that many of us use “Data View” and “Data Form” rather interchangeably. In Windows SharePoint Services v2, we shipped a web part called the DataViewWebPart (DVWP). This web part uses XSLT to transform data from Data Retrieval Services to HTML. In Windows SharePoint Services v3, we shipped a web part called the DataFormWebPart (DFWP). The DataFormWebPart still uses XSLT, but now uses ASP.Net 2.0 Data Source Controls for data access. In addition to “view” functionality, the DataFormWebPart also introduced “form” functionality to write back to various data sources. We use Data View generically to refer to the feature set and all of SharePoint Designer’s UI still uses the term Data View.

Posted in .NET 2.0 | Leave a Comment »

Add Web Part to page using code

Posted by Clayton James on December 31, 2008

     // add Content Editor Web Part
     SPFile NewPage = Web.GetFile(NewPageUrl);
     SPLimitedWebPartManager mgr;
     mgr = NewPage.GetLimitedWebPartManager(PersonalizationScope.Shared);

     ContentEditorWebPart wp1 = new ContentEditorWebPart();
     wp1.Title = txtPageTitle.Text;
     wp1.ChromeType = PartChromeType.TitleOnly;
     wp1.AllowClose = false;
     XmlDocument doc = new XmlDocument();
     string ns1 = “http://schemas.microsoft.com/WebPart/v2/ContentEditor”;
     XmlElement elm = doc.CreateElement(“Content”, ns1);
     elm.InnerText = txtPageContent.Text;
     wp1.Content = elm;

     // add Web Part to Left Zone
     mgr.AddWebPart(wp1, “Left”, 0);

Posted in .NET 2.0 | 1 Comment »


Posted by Clayton James on December 16, 2008

Andy is developing a some user controls that allow blend designers to draw objects and translate these into Physics objects.

Check out his cool little demos here.

I think in 2009 Silverlight will come of age and in 2010 it will burst into mainstream! Just you wait and see 🙂

Posted in .NET 2.0 | 1 Comment »

DropDownList FindByText FindByValue

Posted by Clayton James on November 27, 2008

Am always looking for this code snippet.

If you try to do this, you will not achieve the desire results:


ddlList1.SelectedItem.Text = dropdownValue;


By doing that, it will overwrite existing items. Not a good idea at all. Try this instead; you can either set FindByText or FindByValue.


ddlList1.SelectedIndex = ddlList1.Items.IndexOf(ddlList1.Items.FindByText(dropdownText));




ddlList1.SelectedIndex = ddlList1.Items.IndexOf(ddlList1.Items.FindByValue(dropdownValue));

Posted in .NET 2.0 | 1 Comment »

Display all network printers

Posted by Clayton James on November 27, 2008











A post that I know I will need again.


strServer = \\\\printservername;

//if the computer is local machine, use the “.” instead
ConnectionOptions options = new ConnectionOptions();
options.Username =
options.Password =
options.Authority =


ManagementScope myScope = new ManagementScope(strServer + \\root\\cimv2, options);
SelectQuery oQuery = new SelectQuery(“SELECT * FROM WIN32_Printer”);
ManagementObjectSearcher oResults = new ManagementObjectSearcher(myScope, oQuery);

//Iterate through printers…
foreach (ManagementObject oItem in oResults.Get())
     string strPrinterName = oItem.Properties[“DeviceID”].Value.ToString();

Posted in .NET 2.0 | Leave a Comment »

Where is GacUtil in Windows Server 2008 & VS2008

Posted by Clayton James on November 27, 2008

I regulary run Post Build events in Visual Studio on my development machines to install assemblies into the GAC immediatley after a successful build. This save me a lot of time.

However, have been working with Windows Server 2008 and Visual Studio 2008 and couldn’t find the GacUtil.exe in the usual spots on the file system … e.g C:\Program Files\Microsoft Visual Studio 9.0\SDK.

I finally found the location and it has been moved to C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin

So I can know put in my Post Build events like this:
“C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe” -u “$(TargetName)”
“C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe” -i “$(TargetPath)”

Posted in .NET 2.0 | 9 Comments »

WSS 3.0 Search Database

Posted by Clayton James on November 18, 2008

Stopping and Starting the wss search service seems to create some problems.

If you stop the service and then try to start it again I received a common error

“Databases must be empty before they can be used.  Delete all of the tables, stored procedures and other objects or use a different database.”

So I entered a different database name and then received a error “File Not Found”. I initially thought that this error was referring to the database and that the database wasn’t being thus displaying this error. However I did find out that the new search database was in fact being created so the error must be referring to something else.

The event logs had a warning and two errors referring to registry issues.

Warning – Event ID 10035 – Windows SharePoint Services 3 Search
Could not import the registry hive into the registry because it does not exist in the configuration database.
Context: Application ‘bf3cdd2c-561d-4cd4-aba0-37ddf776115b’

Error – Event ID 10029 – Windows SharePoint Services 3 Search
Error backing up registry hive to the configuration database.
Context: Application ‘Search index file on the search server’
Details: Access is denied.   (0x80070005)

Error – Event ID 2426 – Windows SharePoint Services 3 Search
Advise Status Change failed. The system is probably low on resources. Free up resources and restart the service.
Context: Application ‘Search’, Catalog ‘index file on the search server Search’

Hmmm…..I finally came across this article http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Microsoft_IIS/Q_22875574.html which discuses changing the Search Service account and Content account to use an administrator. Once I did this all was good and the service started.

I then completed a couple of stsadm commands and everything was working fine.
stsadm –o spsearch –action fullcrawlstop
stsadm –o spsearch –action fullcrawlstart

The Search Service account and the Content account mustn’t have had enough permissions to modify the registry which I wouldn’t have thought was needed. The article also mentiones that they worked with Microsoft on this issue and they recomended using one single service account for single server installations. This is the first time I have heard this.

Normal practice is not to use an administrator account to crawl content as you should use the principle of least privileges.

Anyway, hopefully this will help a few people out.

Posted in .NET 2.0 | 9 Comments »

SharePoint Architect Series

Posted by Clayton James on November 5, 2008

Breeze and DDLS are teaming up again to deliver two advanced SharePoint courses.

Breeze and DDLS offer a wide range of SharePoint courses nationally and overseas and I have been lucky enough to be part of the team delivering great course material on a product I am passionate about.

Register and view the course outline below:

Both courses are targeted to SharePoint professionals wanting to learn best practices in architecting and administering SharePoint solutions.

Posted in .NET 2.0 | 1 Comment »

VSeWSS Deployment Issues

Posted by Clayton James on November 4, 2008

I have come across a few deployment issues using VSeWSS. These issues can be time consuming so I am going to start posting Errors and Solutions.
Note: There obviously may be more than one solution to an error so don’t take this as Gospel.

  1. Error
    – Feature ’75a0fea7-c54f-46b9-86b1-2e103a8fedba’ is not installed in this farm, and can not be added to this scope
  2. Solution
    – I had an error in my web.config file. As soon as I fixed this I redeployed from VSeWSS
  1. Error
    – This solution contains two assemblies with the same name, or the SharePoint server already has an assembly with the specified name
  2. Solution
    – Uninstall the assembly from bin or GAC and then redeploy from VSeWSS
  1. Error
    – The Feature name …. already exists in SharePoint. You need to rename the Feature before solution deployment can succeed
  2. Solution
    Deactivate the feature (if it is activated)
    Delete the Feature …. from the 12/Template/Feature directory and redeploy from VSeWSS
  1. Error
    Cannot find this file specified in the manifest file: FileName …
  2. Solution
    Open the Manifest file (Use WSP View) and remove the offending line and redeploy from VSeWSS
  1. Error
    Feature …. is already activated at scope [url]
  2. Solution
    – Deactivate feature through UI or stsadm if hidden

Posted in .NET 2.0 | 5 Comments »