SharePoint 2010 - Updates are currently disallowed on GET requests

Sometimes, when we create a new web application in 2010 and click on 'General Settings' or 'Resource Throttling' menu of it, we used to get the following error.


It occurs randomly for few web applications and the error disappears automatically if try using these menus after few days of creating the web application. Not sure about the reason, but found a workaround/solution from here.

The solution is to ensure the settings in powershell:

           $w = get-spwebapplication http://nameofwebapp/
           $w.HttpThrottleSettings
           $w.Update()

It worked well and we are able to get the settings page now without any issues.

Enhancement in 2010 - Search

Search in 2010 has many improvements when compared to MOSS. Few enhancement that I am aware of:

Wildcard Search
Logical Operators Search
Faceted Search

There is a nice article which explains these concepts with simple example.

http://sharepointchick.com/archive/2009/10/19/whatrsquos-new-for-end-users-in-sharepoint-search-2010.aspx

There are few more enhancements which are described briefly below.

Phonetics

It is common for end users that they might not aware of the exact spelling of the person who is being searched, but they know how it souds phoneatically. The query engine in 2010 has phonetic search capability for searching for people. As long as the spelling sounds like the name of the person (such as searching for 'Reena Sen' whereas the actual spelling is 'Rina Sen'), the engine will find the right person.
 
Rich Previewing (with FAST)
 
2010 provides rich previewing of content by leveraging the integrated FAST technologies. With this, when an Office document is returned in the search result, the users can preview the document. Instead of opening the document to see if it is the result they wanted, they can just preview the document, and then open it if they want to, which saves time for the users.

Suffix Matching

By using the wild card search, we can search for a word by appending * at the end of few letters of the word. For example, search for 'depart*' will return the contents matching with the word 'department'. An additional advantage here is matching of suffix in wild card search. For example, if you search for 'Marketing depart*', the search engine will recognise the suffix as well and return the results which are matching the word 'Marketing department'.

Address book style lookups

People Search in 2010 supports address-book- style lookups which allows you to type an alias for someone and quickly find the person you are looking for.

Enhancement in 2010 - Folders in Pages Library

In MOSS, Folders are not supported in the Pages library in a Publishing site. Though we can turn them on manually by navigating to Settings --> Document Library Settings --> Advanced Settings, the pages created within the folder will always be placed in the root of the Page Library. This behavior is by design.

Refer the following article:


However this issue is resolved in SharePoint 2010 where we can create folders and place pages into them.


Careful when updating Web Site Address field.

In MOSS, there is option to modify the URL of the site after creating it. To modify the URL of a site, we need to do the following.

Click on Site Settings --> Modify All Site Settings --> Title, Description and Icon

In the ‘Web Site Address’ field, change the URL as required and save. Now, the site can be accessed with the new URL. This is straight forward.

However there is an issue with this approach. We should be very very careful while updating this field. If the user who updates the URL, set the URL with a . (dot), for example “newurl.aspx”, then the site won’t be accessible at all. We should make sure that we don’t give . (dot) in the ‘Web Site Address’ field while updating it.

Update:
However it is difficult to instruct all the users to be aware of this issue and requesting them to be careful when updating this field. So, the workaround would be to create an 'WebMoving' event handler which will have the logic of removing the .(dot) and other special characters from the modified Web Site Address field so that the site can be saved with a valid URL.

Redirect to Custom User Information Page

In MOSS, when we click on ‘Personal Settings’ menu or click on any of the username, we will be redirected to the OOTB ‘User Information (Personal Settings)’ page. This OOTB page looks like below.



If you want to change this behavior and want to redirect the users to your custom page, this can be achieved with the following way.

Add an entry in the 'destinationredirects' section of web.config of your web application as below.



Property Promotion Issue in ItemAdding Event

There is an issue in ItemAdding event which is specific to Office 2007 documents. When we set value for a column using ItemAdding event, the value disappears after the item is added to the library. This is happening ONLY for Office 2007 documents.
For example, we have a custom column ‘Owner’ in the document library. We are setting the value of ‘Owner’ column in the ItemAdding Event as below.

When a document which is not Office 2007 document is uploaded, it is set correctly and the value is saved to the item.


However, when a document of type Office 2007 is uploaded, the field value is set in ItemAdding, but the value becomes blank after the item is added. (Note that the ‘Title’ column is blank in while uploading the document. This is a different issue.)


This is an issue with Office 2007 and the WSS 3.0 xml parser. When the properties are promoted from the Office 2007 document, the parser attempts to assign document properties to the list properties in SharePoint (property promotion). However the problem is that this event occurs after any ItemAdded, or ItemUpdated events, so the property gets overwritten with the value in the document, which is of course, blank.

We had a Microsoft case on this issue and following are the workarounds suggested.

(1) Set the owner field as not required, so that you later can change the field to the current user value (in ItemUpdated event)

(2) You can set the owner field to read/Only, but this would hide the field in the UI and the user cannot modify the value, so that the owner field is always the current user, if the ItemAdding handler set this value appropriate.

(3) You can go to SharePoint 2010, which does not have this issue.

(4) Set SPWeb.PareserEnabled = False for the web, but this has also draw backs. F.e. you wouldn’t see the properties in the Office documents, if PareserEnabled is set to false; see

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.parserenabled.aspx

(5) Within the ItemAdding event you could create a new thread which sleeps for some seconds and after that it will do the work, setting the owner property appropriate to the list item. That could work but because of the delay, the change will be done later.


Update SharePoint User Profile property value

Do you want to update the value of a User Profile property in your SharePoint environment programatically? (For example, changing the value of 'Office' from 'Office A' to 'Office B'). You can use the following method to achieve this. Just pass the User Name, name of the property to be updated and the value that needs to be updated as parameters for this method.

Ex: UpdateProfilePropertyValue("MyServer\\TestUser","Office","Office B");
 
 
 
 
 


This is applicable both for OOTB properties and custom properties.

Note:

Reference to the DLL 'Microsoft.Office.Server.dll' (c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.Office.Server.dll) and the following using directives are required.

using Microsoft.Office.Server;
using Microsoft.Office.Server.UserProfiles;

SharePoint Error : The trial period for this product has expired

We encountered this error when we tried to create a new site. However we were able to resolve the issue with the help of  following steps.
  • Navigate to Central Administration -> Operations -> Service Accounts (under Security Configuration)
  • Choose “Web Application pool”
  • Select the correspoding application pool
  • If selected account is Predefined - “Network service”, configure it to your site collection administrator.
  • Try creating the site after switching the account to your site collection administrator.

SPNavigationNode.IsVisible returns always true

SPNavigationNode.IsVisible returns always true no matter whether the web is marked as hidden or visible in the navigation.

Example :

using(SPSite Site = new SPSite(URL))
{
  using(SPWeb Web = Site.OpenWeb())
 {
    SPNavigationNodeCollection Nodes = Web.Navigation.TopNavigationBar;

    foreach(SPNavigationNode Node in Nodes)
    {
       if(Node.IsVisible)...//returns always true even if the node is marked as hidden..

    }
 }
}

There is a workaround provided here. However this is applicable for Publishing sites. For other sites, the following workaround can be used.

private static bool isHiddenWeb(SPWeb targetWeb)
{
   SPSite site = new SPSite(URL);
   SPWeb web = site.RootWeb;

   string GlobalNavigationExcludes = (string)web.AllProperties["__GlobalNavigationExcludes"];

   Hashtable ReturnExcludedUrls = new Hashtable();
   if (!String.IsNullOrEmpty(GlobalNavigationExcludes))
  {
     string[] ExcludedGuids = GlobalNavigationExcludes.Split(';');
     for (int i = 0; i < ExcludedGuids.Length - 1; i++)
    {
        string guid = ExcludedGuids[i];
        Guid ExcludedGuid = new Guid(guid);
        SPWeb SubWeb = web.Webs[ExcludedGuid];

        if (SubWeb.Url == targetWeb.Url)
        {
           return true;
        }
    }
 }
 else
 {
    return false;
  }
 return false;
}

Few Notes on SharePoint 2010 - 2

Service Applications

With SharePoint 2010, Shared Service Providers are dead and the new Service Application model takes over. A brief note on the challenges with SSP and overview of Service Applications is below.

Challenges with SSPs in MOSS 2007
  • Web applications were limited to consuming from single SSP
  • Deploying SSPs was difficult
  • SSPs were tied to a single farm
  • SSP management and troubleshooting was difficult
  • Shared services were not extensible
Service Applications Overview
  • Service applications replace the MOSS 2007 SSP
  • The service application framework is now in MSF2010
  • Many-to-many relationship between web applications and service applications
  • Service applications offer improved scalability, load balancing and fault tolerance
  • Service applications can be consumed across farms
  • Windows Powershell support 

Few Notes on SharePoint 2010 - 1

This is a collection of few notes on SharePoint 2010 sourced from Internet.

Setup Prerequisites

MSF2010 requires the following configuration. If they are not met, setup will fail.
  • 64-bit Windows Server 2008 SP2 or greater (server core version not supported)
  • 64-bit Windows Vista or greater (no product support)
  • SQL Server 2005 SP3 CU2/SQL Server 2008 SP1 CU2/R2, 64-bit. 32-bit SQL Server is not supported.
  • The Microsoft .NET Framework 3.5 SP1 or greater
  • Windows PowerShell version 2 or greater.
  • The setup run-as account must be a member of the local administrators group.
  •  Microsoft Internet Information Services 7.x (IIS 7.x) or greater with IIS 6.0 management compatibility component installed.
  • ASP.NET 3.5 server extensions enabled.
  • Geneva Framework, IDFX
  • Speech
  • Synch Framework
  • Filter Pack
  • ADO.NET (for LINQ - Language-Integrated Query)
Services in SharePoint 2010 Products



New Search Features

 Features for End Users
  • Faster search results
  • Enhancements for relevance of search results
  • New User interface elements
  • More “social” search experience
  • Sugestions while typing search queries
  • Suggestions after executing queries
  • Connectors for Enterprise Search in Windows 7
  • Improvements for search results display
  • People search
  • SharePoint Server 2010 provides enhancements to increase the relevance of search results
Features for IT Professionals
  • Improved scalability and reliability
  • Easier to setup in simple environments
    • Setup Wizard
  • Profile Import no longer relies on search
  • Connector framework
    • Exchange
    • Notes
    • EMC Documentum
    • IBM File Net
    • Open Text
  • Better logging
    • Determine if a page has been crawled.
    • View errors/success/warning by host name.
    • Filter, sort and search the logs.
    • Prevent an item from returning in search results from the crawl log.
    • Re-crawl an item from the crawl log.

Get rid of Login Prompt

When we create a SharePoint web application with host header and try to access the same within the same server, we may keep on get prompted for user name and password. However the same application will be accessible from other machines in the same domain. This section provides a resolution for the issue.


Problem:

1. Create a web application (windows authentication) with a host header (Ex: abclimited.com)and create the corresponding site collection.

2. Add relevant entry in the Hosts file.

3. Enter the URL of the site collection which was created above (http://abclimited.com ) in Internet Explorer and hit Enter.

4. You will be prompted for the User name and password.

5. Even after repeated entry of correct user name and password, you will not be authenticated and site will not appear.

Solution:

To avoid the above problem, the following steps need to be followed.

(Reference: http://support.microsoft.com/default.aspx/kb/896861)


1. Click Start, click Run, type regedit, and then click OK.

2. In Registry Editor, locate and then click the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0

3. Right-click MSV1_0, point to New, and then click Multi-String Value.

4. Type BackConnectionHostNames, and then press ENTER.

5. Right-click BackConnectionHostNames, and then click Modify.

6. In the Value data box, type abclimited.com and then click OK. Quit Registry Editor.

7. After completion of all these steps, the site should appear fine with the URL http://abclimited.com. (If the site does not come up with the given URL, restart the IISAdmin service and try again.)

Collection of MOSS 2007 PowerShell Script

Excellent collection of PowerShell scripts for MOSS 2007 by Goude is available here. Worth reading.

Open attachments in a list, without having to open that record

Recently, I have answered for one of the queries raised in a SharePoint forum. Copying the same here for reference.

Question:

Hi

I've created a customized list and enabled the option that makes users possible to add an attachment.
Enabling this option added automatically a new column with as "name" an icon of a paperclip.
That's fine to me, but when an attachment is added to a record, that icon als appears.

Is it a possible to change this, so the name of the attachment is listed?
Is it possible to add the location of the attachment (hyperlink) to that name.

I don't find it very userfriendly that the users can't see what the attachment is handling about.
I would like that they don't have to open each record to find out.

Thx for help

Best Regards

Tom

My Answer:

Hi Tom

This can be achived with the following steps.

1. In your custom list, create a new Hyperlink column with the name 'Attachment' and add it to the view as you wish.

2. Creata a simple Console Application and write the following code.

SPSite site = new SPSite([URL of your site]);
SPWeb web = site.OpenWeb();
SPList list = web.Lists[[Display Name of your list]];

           
for (int i = 0; i < list.Items.Count; i++)
{
   SPListItem item = list.Items[i];

   
   if (item.Attachments.Count > 0)
   {
      string attachmentURL = item.Attachments[0];
      item["Attachment"] = item.Attachments.UrlPrefix +  attachmentURL + ", " + attachmentURL;
      

      item.Update();
    }
}

3. Execute the code and see the result in the list.

Note: This solution assumes that you are adding only one attachment per list item. If you want to use it for multiple attachments, you may need to try a different approach.

Thanks
Bala

Get rid of blank entries when 'Append Changes to Existing Text' is turned on

Most of us are aware of the option 'Append Changes to Existing Text' which gives provision to display multiple comments appended to a list column. However, it will add blank entries to the column for every save operation, even if you did not want to enter anything and just click 'OK' without making any change to the item as below.





There is a simple solution to get rid of this behaviour. Just change the column type from 'Rich Text' to 'Plain Text'.










You can see the difference now. There will not be any blank entries in the column if you dont enter anything.

Hide web part if zero rows

1. Add a Content Editor Web Part to the page.
2. Edit the web part and add the following script in the 'Source Editor'.
 

 
 
 
 
 

Thanks to the original author of the script.

Pre-Fill a Text Field with a Query String Value

1. Add a Content Editor Web Part to the page.
2. Edit the web part and add the following script in the 'Source Editor'.
 

 
 
 
 
 
 
 
 
 
 
 
Note:
The above example assumes that you pass a Query String parameter called 'InvoiceAmount' and you have a Text field in the form with the display name 'Invoice Amount'.
 
Thanks to the original author of the script.

Disable a field in NewForm.aspx/EditForm.aspx

1. Add a Content Editor Web Part to the page.
2. Edit the web part and add the following script in the 'Source Editor'.
 

 
 
 
 
 
 
 
 
 
Thanks to the original author of the script.

Hide 'New Item' menu in DispForm.aspx

1. Add a Content Editor Web Part to the page.
2. Edit the web part and add the following script in the 'Source Editor'.

















Thanks to the original author of the script.

Hide a field in NewForm.aspx/EditForm.aspx

1. Add a Content Editor Web Part to the page.
2. Edit the web part and add the following script to the 'Source Editor'.













Thanks to the original author of the script.

Information on SharePoint Database Schema

Lot of us might be interested to know the schema information for SharePoint configuration and content databases. Read the documentation here.

Warning!
Do not modify any of the tables in the database directly. It is strictly not supported by Microsoft.

Thanks to Subhajit for providing this useful information in his blog (http://blogs.msdn.com/subhajitc)

How to configure a Document Library programatically

How to delete a web part completely?

We may come across situations wherein a web part might cause problem for loading of the page itself. In these situations, we need to delete the problematic web parts. Since the page itself is not loading proeprly, we need to use Web Part Maintenance page to delete the problematic web part.

You can navigate to the Web Part Maintenance page just by adding the querystring of '?contents=1' to the end of your URL.

Example: http://yoursite/whatever/default.aspx?contents=1

How to bring back the closed web part?

These are the steps to bring a web part back on a page:

Site Actions -> Edit Page
Click Add a Web Part
Click Advanced Web Part gallery and options
Click Closed Web Parts
Drag closed web part onto the page

Restriction of characters in sites, folders and files in MOSS

The following table has the list of characters/naming conventions that are not permitted in Office SharePoint Server 2007.





















References:
http://support.microsoft.com/default.aspx?scid=kb;en-us;905231
http://technet.microsoft.com/en-us/library/cc261812.aspx

How to change the order of view fields

How to change the display order of fields in the view of a document library - programmatically


'Save site as template' link not visible

In the sites where 'Publishing' feature is activated, the link 'Save site as template' may not be available in the Site Settings page. It is due to the following reason.

The ‘PublishingSiteSettings.xml’ file which belongs to ‘Publishing’ feature may have the following element which hides the ‘Save site as template’ link in the ‘Site Settings’ page of the sites in which ‘Publishing’ feature is activated.


The same might have been added to avoid the issue mentioned in the following KB article.

http://support.microsoft.com/kb/925189/en-us

Though the ‘Save site as template’ link is not visible, we can save the site as template by directly typing in the URL as follows.

http://server/sites/mysite/_layouts/savetmpl.aspx

The issue described on the KB article above does not seem to occur now, provided the latest Service Packs and HotFixes are deployed in the server.

'Length cannot be less than zero' error in SPImport

Recently, we came across an issue with SPImport. On attempting an import using Content Deployment APIs, we received the following error.

Length cannot be less than zero.
Parameter name: length

This error occurred during the import of a ListItem. We thought it could be a code issue, but actually it was not. We got the same error when we tried the import operation using stsadm command as well. Then we realised that there is something wrong with the data/properties.

We did further analysis and found out that it was a custom site column in our content type which causes this issue. The custom column is of type 'SPUser'. We deploy this custom column through a field definition file. The error occurs because the field was missing an attribute called List="UserInfo" in its definition. SPImport operation was successfully executed after adding this attribute to the column.

Whenever you add a custom field of type SPUser, please ensure that the attribute List="UserInfo" is added to the field definition.

How to find if the current user belongs to specific group

Sometimes, we may need to find out whether the currently logged in user belongs to a specific AD Group or SharePoint Group. This can be achieved as below.

To find out if the current user is a member of AD Group:



To find out if the current user is a member of SharePoint Group:

Sharepoint Daily Alerts not working

Recently, we had an issue in Daily Summary alerts of a Sharepoint list. The users were getting immediate alerts without any problem. However, the daily summary alerts were not sent to their email. We did some initial analysis and opened up a support case at last.

After spending a week's time by digging through the problem, we found that the issue is due to the System Time difference in Index Server, WFE Server and Database Server. Each server had different system time on it. The daily summary alerts started working once we synced up the time in all the servers.