Sunday, December 16, 2007

while trying to activate the 'publishing infrastructure feature'. Access denied error.

Web app's application pool needs to be set to the sharepoint central admin admin pool.

Locate the Web Site in IIS. ->Properties -> home directory -> change the application pool to the central admin's application pool -> iisreset -> Publishing feature activation on the website -> switch back the web site's app pool to original ->iisreset.

Tuesday, December 11, 2007

Publishing site not showing all the site definitions/site templates

Problem:
While trying to create a sub site under a publishing top level site, you will see only "Publishing site with workflow" site definition in the available templates. You can not see any other site definitions like team site and document work space.


Fix:

Site Actions -> Site Settings -> under look and feel -> Page layouts and site templates -> select the templates that you want to be available for the sub site creation.

Saturday, December 1, 2007

View all site content shows empty lists and libraries.

Problem: When you click on the 'View All site Content' link, it shows empty lists.
Fix: Go to the site features and activate the 'Team Collaboration Lists' feature.

Saturday, November 3, 2007

People and Groups bulk email issue

Problem:
If you have more than 60 users in a sharepoint group, while trying to e-mail to all the users nothing happens. Unlike the normal lists, group views do not have the 'edit view' to edit the item limit.
Reason:
When you click on 'Action-> email URL is formed like 'mail to: onemail; twomail;.......'
As you know, IE has a limitation to process 2048 characters. So if you select more than 60 users, it will get jammed.
Fix:
If it is okay to change the item limit follow this:
  1. Go to the groups page(People.aspx)
  2. Settings -> list settings
  3. click on the desired view under the 'Views' section
  4. In the item limit area, limit the items you want to.

For any reason, if you do not wish to change the item limit follow this:
This procedure basically copies all the email ids to a clip board, that you can paste manually into the notes/outlook.

  1. Locate the 'People.aspx' page and open.
    C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS
  2. Locate the code block for the function 'function BtnEmailClick(viewId)' and replace with the following code.

    function BtnEmailClick(viewId)
    {
    var emails = GetSelectedUsers(viewId, "email", ";");
    if (emails.length == 0)
    {
    alert(noUserEmailSelectedMsg);
    return false;
    }
    emails = escapeProperly(emails);
    emails = unescape(emails);
    // get rid of the anchor mailto:
    emails = emails.replace(emails.substring(emails.indexOf('<'), emails.indexOf('>', emails.indexOf('<')) + 1), "");
    // Post the string to the clipboard if IE.
    if (ClipBoard(emails))
    {
    alert( countNeedles(";", emails) + " email addresses have been copied to your clipboard.");
    }
    return false;
    }

    //Copying mails to the clipboard
    function ClipBoard(s)
    {
    if (!document.all)
    return false;
    // This is for IE only
    var holdtext = document.getElementById('holdtext');
    holdtext.innerText = s;
    var Copied = holdtext.createTextRange();
    Copied.execCommand("Copy");
    return true;
    }

    //Counting the number of mail ids to confirm the user
    function countNeedles(needle, haystack)
    {
    count = 1;
    pos = haystack.indexOf(needle);
    while ( pos != -1 )
    {
    count++;
    pos = haystack.indexOf(needle, pos+1);
    } return count;
    }

  3. Any where in the page, paste the following line. In my case, I pasted after the 'ms-quicklaunchheader' DIV tag.
    <TEXTAREA ID="holdtext"></TEXTAREA>

Saturday, October 20, 2007

No Web parts Found.. while adding the webparts

Problem Definition:

After creating a '.stp' file out of a site, and adding this .stp template to a farm using stsadm, when you try to add webparts to the new site collection that has been created with the custom site template, you will get the error ''No Web parts Found.."



Fix:

  1. You can manually copy the webparts from the tempalte site webpart gallery and paste into the destination webpart gallery. But web parts are not grouped in sections(Content Rollup, dashboard, mislaneous, all webparts etc)
  2. You can also go to the new site webpart gallery and populate the webparts manually.
    (Site Actions -> Site Settings -> Galleries -> Webpart Gallery -> New -> select the webpart you desire -> populate)
  3. Run the following code using a console application if you wish to add the webparts only once. If you are running like this, then uncomment the line 'SPSite ProvisionedSite = new SPSite(provisionedSiteUrl);' and comment the line 'SPSite ProvisionedSite = SPContext.Current.Site;'

    If you wish to have the webparts copied automatically, each time you create a site, then go for a feature and embed this code in the 'Feature_Acticated' method of the feature.
//code for copying webpart files from the template site to provisioned site
public static void CopyWebParts(string templateSiteUrl, string provisionedSiteUrl)
{
// Get the context of the template site
SPSite templateSite = new SPSite(templateSiteUrl);
// Access the Template site Webparts folder under _catalogs
SPFileCollection templateWebParts = templateSite.RootWeb.Folders["_catalogs"].SubFolders["wp"].Files;
// Below line is commented as this code is meant for automatic execution.Un comment this line, if you want to run this code as a console application.
//SPSite ProvisionedSite = new SPSite(provisionedSiteUrl);
// Load the properties of the existing file
// Get the current site context
SPSite ProvisionedSite = SPContext.Current.Site;
// Access the Provisioned site Webparts folder under _catalogs
SPFileCollection ProvisionedWebParts = ProvisionedSite.RootWeb.Folders["_catalogs"].SubFolders["wp"].Files;
foreach (SPFile templateWebPart in templateWebParts)
{
// Load the properties of the existing file
byte[] binaryData = templateWebPart.OpenBinary();
// Copy the file
SPFile copiedFile = ProvisionedWebParts.Add(templateWebPart.Name, binaryData, true);
copiedFile.Update();
// Update the properties of the copied file

copiedFile.Item["Group"] = templateWebPart.Item["Group"];
copiedFile.Item["Quick Add Groups"] = templateWebPart.Item["Quick Add Groups"];
copiedFile.Item.Update();
copiedFile.Update();
}
}
 
Note:Always activate features through the browser.
Do not activate this feature through command prompt stsadm.exe.
Coz, stsadm doesn’t know the current context of the site.

Saturday, October 13, 2007

Login failed for user 'Domain Name\

When you see the error ' Login failed for user 'Domain Name\<SharePoint Server Name>', follow the below command: 

STSADM.EXE -o provisionservice -action start -servicetype “Microsoft.Office.Excel.Server.ExcelServerSharedWebService, Microsoft.Office.Excel.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”

Friday, October 5, 2007

Sharepoint server is too busy

There are so many reasons for this issues, lets go over all the possible reasons and fixes.

Reason 1: Not enough CPU speed.
Fix: Add more CPUs to the existing one and upgrade the speed to at least 4 Ghz.

Reason 2:
Make sure that the server is NOTrunning in the debug mode. Usually dev and QA servers are enabled with debug mode for interactive trouble shooting. All production servers are supposed to run in the 'non-debug' mode. If you are running in the debug mode, all the intermediate variables and values are cached for the debugging purpose. If you have a single variable for a code block, never think that it is gonna be a single variable on the server. A copy of the variable gets created each time a user access the code. FIX:
Disabling the debug mode for all the asp.net applicationsGo to the machine.config located at the location:C:\Microsoft.NET\Framework\%VersionNumber%\CONFIG\Your compilation mode should look like this:
<compilation debug="false"/>

Disabling the debug mode for only the sharepoint C:\Inetpub\wwwroot\wss\VirtualDirectories\80 and open the web.config(This path is for the default 80 port. If your application is running on other ports do this for all the other ports)Your compilation mode should look like this:
<compilation batch="false" debug="false">



Reason 3: Sharepoint master page or any custom page accessing asp code. Eg, IFrame rendering .asp file. This problem occurs if you have sp1 on 2003 server and do not have sp2.
Microsoft included this hot fix in the sp2.

Fix: Microsoft has hot fix to correct this problem.
http://support.microsoft.com/kb/916984

http://support.microsoft.com/kb/188352

Reason 4: Full Crawl tries to authenticate the users.
Fix:

On the application server,

  1. This is for the general sharepoint server slow.
    start - > Run -> regedit -> HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\web server extensions\12\WSS
    right click on the WSS -> permissions -> Add user/group -> Everyone -> Read access
  2. This is for the Full Crawl/Incremental crawl causing server slow
    start - > Run -> regedit -> HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\web server extensions\12\Search
    right click on the Search -> permissions -> Add user/group -> Everyone -> Read access
Reason 5:
Network Traffic increase.

Fix:

If your website keeps growing and growing, eventually you will hit the error 500-13, that your server is too busy to handle the requests. What do you do?

First, check your main settings in IIS. Make sure you look in the PERFORMANCE tab. Set your site to more than 100,000 hits/day which is probably true if you are running into this error. Remember that hits includes every file you send out - including graphics - and is much larger than your page view count.

On that same page, be sure to turn off bandwidth throttling and process throttling.

Next, on your main entry in your IIS manager, right click to get properties. Go into Server Extensions - Settings. Depending on your use of include files and images, you may want to increase the cache sizes there.

To monitor the issue, open the performance monitor in your control panel. Right click on the lower right area to add a new item to monitor. You should add in -

ASP - requests queued
ASP - requests executing
ASP - script engines cached
Processor - % processor time
Memory - available bytes

I highly recommend using XCompress which is an ASP compressor, helping to ensure that you use as little bandwidth as possible in sending your ASP files out to end users.

If you want to take your life into your own hands, you can also try setting the cache settings manually. You need to launch a CMD prompt first. Head into inetpub\adminscripts. Then run commands:

adsutil set w3svc/1/AspQueueTimeout 30
adsutil set w3svc/1/ServerListenBackLog 500
adsutil set w3svc/1/MaxEndPointConnections 500

Those will help reduce your timeout from its unlimited initial state, and set higher limits on the backlog and max connections values. Be sure to backup before trying this!

In addition, you can go back into the IIS manager and right click for the properties. Go into Home Directory then Configuration. You get a special tab in here for Process Options that is not available on a single-website basis. Set the cache values up high enough based on the performance monitor entries.

Reason 6:
Script errors on the pages running under the server. To fix this issue, look for all the script errors by the 'err' object to diagnose. Also look whether they are leaving any un allocated objects in the stack.

Tuesday, September 4, 2007

cannot find Excel Web Access webpart in the gallery

Situation:

While trying to drag drop the webparts, can not find the 'Excel web access' webpart in the list.

Fix:
  1. copy paste the following code into a note pad and name it as 'ExcelWebAcces.webpart'.
  2. upload the 'ExcelWebAcces.webpart' file into the 'webpart gallery (Site Actions -> Site Settings -> webparts)

<?xml version="1.0" encoding="utf-8" ?>   
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">  
<Assembly>Microsoft.Office.Excel.WebUI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>   
<TypeName>Microsoft.Office.Excel.WebUI.ExcelWebRenderer</TypeName>   
<Title>Excel Web Access</Title>   
<Description>Use the Excel Web Access to interact with an Excel workbook as a Web page.</Description>   
<FrameType>TitleBarOnly</FrameType>   
<PartImageSmall>/_layouts/images/ewr023.gif</PartImageSmall>   
<PartImageLarge>/_layouts/images/ewr023.gif</PartImageLarge>   
</WebPart>

Sunday, July 29, 2007

My Links webpart display on a page

If you want to display 'My Links' webpart on any sharepoint page, there are two ways to do.

1. My Links webpart with all the tool bar links:
  • Go to the webpart library ( Site Actions -> site settings -> galleries -> Web Parts )
  • New
  • Check for the 'Quick Links Micro view' webpart and 'Populate gallery)
  • Now, My Links web part is ready in the webpart browser.

2. My Links web part without any tool bars.

  • Go to the actual 'My Links' webpart available on the 'Profile' page.
  • context menu -> Export
  • Save the ".dwp" file on your local disk.
  • Go to the page, you wanna display the webpart -> Site Actions -> Edit Page -> Add webpart -> Import
  • Select the '.dwp' file that you just saved on the disk.

How to change the Title URL of the 'My Links' webpart

'My Links' webpart title is formed dynamically. Even though you change the URL from the properties/dwp file's detail link, page refresh will get the default My Links URL again.
Structure of the My Links title URL:
"Personal site provider URL"/_layouts/MyQuickLinks.aspx

So, if you wanna change the URL of the title, you need to change the "Personal site Provider URL", whcih can be set on the SSP settings page(Sharepoint Central Admin -> SSP -> My Site Settings -> Personal site provider)

Friday, July 27, 2007

DVD player is skipping and making noise

Issue:

last week I got a DVD from Netflix which was completely cracked and pasted with a plaseter to fool the customers. Without the knowledge, I inserted into my DELL INSPIRON machine. After that moment, whatever DVD I try to play on my lappy, it keeps skipping the voice/picture and made me irk!!

Solution:

1. Right click on My Computer
2. Select Properties
3. Click on Hardware
4. Click on Device Manager
5. Double click on IDE ATA/ATAPI controllers
6. Double click on Primary channel
7. Click Advanced Settings and check it says DMA if available and is set to Ultra DMA, mode 5.
8. Do the same for the secondary channel -- it should be Ultra DMA, mode 2.

If your PC doesn't have DMA enabled, the easiest way to re-enable it is to remove the channel and reboot. Windows will then automatically reinstall it and reset the counters that deactivated DMA in the first place.

To remove the channel:
Right click on the relevant channel in Device Manager (you know how to get there - follow steps 1 thru 5 above )
Click on uninstall
Reboot
When you have rebooted (and the drive and been recognised by Windows again), go back to Device Manager and change the setting to DMA if available.
Windows NT/2000 users reboot again. XP users, you're good to go.

Tuesday, July 24, 2007

BreakRoleInheritance throws Access is denied error.

Error Details:
While performing list item updates programmatically, you try to elevate the permissions or trying to impersonate or Brake the role inheritance, you get the following error. You will not get this error if you are logged in as an admin. Only contributor users face this error.
Error in the log:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex) at Microsoft.SharePoint.Library.SPRequest.UpdateRoleAssignment(String bstrUrl, Guid& pguidScopeId, Int32 lPrincipalID, Object& pvarArrIdRolesToAdd, Object& pvarArrIdRolesToRemove) at Microsoft.SharePoint.SPRoleAssignmentCollection.UpdateAssignment(Int32 principalId, SPRoleDefinitionBindingCollection bindings, Boolean addOnly) at Microsoft.SharePoint.SPRoleAssignmentCollection.Add(SPRoleAssignment roleAssignment) at MYDLL.MYDLLHandler.ItemAdded(SPItemEventProperties properties)

FIX:

Use "Allow unsafe updates=true" After each and every code line. You MUST use this statement before and after the "BreakRoleInheritance" line. Ofcrs Make it false only once, while leaving the whole code.
That should fix the issue, if you are still facing the problem, follow the below one by one. Any one of the solutions should fix your problem.

  1. Believe me, I spent countless hours to get this simple solution.
    Code the SPSite and SPWeb instances after the RunWithElevatedPrivileges(delegate() line. But initiate the context before the code line.
    Always go with Ids instead of site or webs, if you are facing the problems even after this solution.

    Guid MywebGuid = SPContext.Current.Web.ID;
    Guid MysiteGuid = SPContext.Current.Site.ID;
    //RunWithElevatedPrivileges(delegate() code block
    SPSite MySite = new SPSite(MysiteGuid)
    Keep in your mind that all the site context declarations/assignments (Guid MysiteGuid = SPContext.Current.Site.ID) should be made before the RunWithElevatedPrivileges(delegate() line. Coz, even though the user is elevated with the full control permissins using the RunWithElevatedPrivileges(delegate() line, if you declare/assign the values after the code line, while assigning the context values, control switches back to the contributor access.
    But, where as if you declare/assign the values before the code line, context will be initiated as the contributor first and then enters in the code block as the full control user with the context carried over. So no issues.
  2. Use IDs instead of ListItems.This makes sure, not to reuse an object that was created in the context of a non-administrative user
    Guid listID = properties.ListId;
    Guid listItemID = properties.ListItemId;
    SPListItem listItem = web.Lists[listID].GetItemById(listItemID);
  3. If this list is a document library, make sure you have the file checked-in before the "RunWithElevatedPrivileges" line or else check out the list item to the system account.
    properties.ListItem.File.CheckIn()
    In the case of Admin login, you were the admin and was going through the system checkout by default:
    Also check on the application pool id being the same as the elevated.
  4. Disable all the events being fired.

Sunday, July 22, 2007

IE Developer Toolbar not working

Situation:

After installing the IE dev tool bar while clicking on the 'select element by click' button, nothing happens.

Fix:


  1. Tools -> Internet options -> Security Tab -> Local Intranet -> Custom Level -> Run ActiveX Control or PlugIn (Administrator Mode).
  2. Tools -> Internet Options -> Programs -> Manage add-ons -> IE Developer Toolbar BHO -> Enable (requires browser restart).
  3. Tools -> Internet Options -> Advanced -> Enable third party browser-extensions (requires browser restart)

If you still can not fix the problem, try it on any other usual page, eg. google.com. If works, then there is an issue with the specific page that you are trying to.

Some identified code blocks:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd%22&gt;

  2. overflow:hidden

Friday, July 6, 2007

Enable drop dowm menu on a team site's top link bar

By default, Sharepoint publising site's top link bar has the two level drop down menu that allows you to hide the sub menu items until the parent menu item gets mouse over.

But, the team site's top link bar doesn't have the functionality by default.

Here are the steps to achieve the dropdown menu functionality within a team site.

  1. Locate the masterpage file for the page on which you wanna see the two level menu.
    Usually it will be "default.master" unless some one has changed the masterpage.
  2. open the default.master in the sharepoint Designer.
    Open the site in the Sharepoint Designer and access th masterpage located at "/_catalog/masterpage/default.master" from the folder list.
  3. If you do not have the sharepoint designer, then open the file directly from the following location: "C:\Program Files\Common Files \Microsoft Shared\Webserver Extensions\12\Template\Global\default.master.
  4. Locate the "SiteMapDataSource" node in the default.master code
    <asp:SiteMapDataSource .. >


    and replace it with:
    <asp:SiteMapDataSourceShowStartingNode="True"SiteMapProvider="SPSiteMapProvider"id="topSiteMap"runat="server" />

  5. To get the dynamic menu loaed each time you access the top link,
    locate the
    < SharePoint.AspMenu  > 


    and change the "StaticDisplayLevels" and "MaximumDynamicDisplayLevels" values to:

    StaticDisplayLevels="2"
    MaximumDynamicDisplayLevels="1"

  6. If you wanna explore the sub menu to further levels, increase the MasimumDynamicDisplayLevels value to the value you desire. I guess, it is limited to 4.

Monday, July 2, 2007

Extending Stsadm.exe with Custom Commands using the ISPStsadmCommand Interface

The configuration files that indicate to stsadm.exe which operations are available for execution are located in the 12 hive( C:\program files\common files\microsoft shared\web server extensions\12\CONFIG)
There 10 or more "stsadmcommands.customcommands.xml" xml configuration files located in the folder, where customcommands is arbitrary but must be unique. Through this naming convention for configuration files, stsadm.exe implements a pluggable architecture for declaring custom operations

The configuration file itself is a simple XML document with a <Commands/> root element containing one or more <Command/> sub-elements. These <Command/> sub-elements are where we declare custom operations and include two attributes name and class. As would be expected, the name attribute indicates the name of the operation to be executed by stsadm.exe. Note that the exact value of the name attribute will be specified by an administrator at runtime using the -o named parameter in order to execute the declared custom operation. The second attribute class specifies the class and .NET Assembly name where our classes that implement the ISPStsadmCommand interface live.


The .NET assembly containing our compiled custom operation(s) will be placed in the Global Assembly Cache (GAC) prior to runtime. This assembly contains one class for each custom stsadm.exe operation, and each of these classes must implement the ISPStsadmCommand interface. Each class that implements the ISPStsadmCommand interface is required to contain a GetHelpMessage method and a Run method. The GetHelpMessage method returns a string value containing help and usage information for the custom operation.

At runtime, the Run method will receive a StringDictionary parameter from stsadm.exe which consists of key/value pairs containing all named parameters, values and flags input from the WSS administrator. The Run method also takes an out type parameter which will be echoed back to the console window upon execution of the custom operation.

After writing a console application and placing the config info in the xml files, you can invoke the new command prompt.

How to create the Publishing pages programmatically into sharepoint

MOSS 2007 shipped with a customizable STSADM command that you can add any custom commands by using IStsadmcommand interface.
Create a console application with the following logic, Add this command to the STSADM.

Link to add the custom STSADM command: http://sharepointsolutions.blogspot.com/2006/09/extending-stsadmexe-with-custom.html


public void FillPublishingWebWithPages (string publishingSiteCollection, int pagesToCreate)
{
SPSite siteCollection = null;
SPWeb site = null;
PublishingSite publishingSite = null;
PublishingWeb publishingWeb = null;
try {
// get the PublishingWeb
siteCollection = new SPSite(publishingSiteCollection);
site = siteCollection.RootWeb();
publishingSite = new PublishingSite(siteCollection);
publishingWeb = PublishingWeb.GetPublishingWeb(site);
// Article Page content type
SPContentTypeId articleContentTypeID = new SPContentTypeId("0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D");

// get the ArticleLeft.aspx Page Layout
PageLayout[] layouts = publishingWeb.GetAvailablePageLayouts(articleContentTypeID);
PageLayout articlePageLayout = layouts[1];
// create a temp name...
string pageName = DateTime.Now.ToString("yyyyMMdd-HHmmss");
// create the specified number of pages
for (int i = 0; i < pagesToCreate; i++) {
PublishingPage newPage = publishingWeb.GetPublishingPages().Add(string.Format("{0}_Gend_Page_{1}.aspx", pageName, i), articlePageLayout);
newPage.Update();
}
} catch (Exception ex) {

throw new Exception(ex);
}
finally
{
// properly dispose of the resources
site.Dispose();
siteCollection.RootWeb.Dispose();
siteCollection.Dispose();
}
}

Saturday, June 23, 2007

Edit Page menu item missing or disabled in the sharepoint publishing site actions menu

Situation:

After creating the master page with all the place holders, edit page menu link in the site actions menu is disabled or hidden.

Reason:

Master Page is missing the editable regions(webpart zone) or page has been checked out to another user.

Fix:
  1. Go to the 'Pages' document library, where all the publishing content pages are stored and check whether the specific page is checked out to any user. if it is checked out to any, ask that person to check in or forc the page to un do the check out. You can also check the status of the page from the Sharepoint Designer.
  2. Check whether any editable region ( webpart zone) existing on the page. If not, then open the page in sharepoint designer -> insert -> sharepoint controls -> webpart zone.
    Edit Page menu item is disabled until there is a single webpart zone availalble on the page.
  3. Check for the SP Navigation delegate control on the page. If not, then add the following lines in the master page. SP navigation delegate is the one that contains 'submit for approval' /approve/ reject buttons on the page while the page is in the edit mode.

<asp:ContentPlaceHolder ID="WSSDesignConsole" runat="server">  
<wssuc:DesignModeConsole id="IdDesignModeConsole" runat="server"/> 
</asp:ContentPlaceHolder> 
<asp:ContentPlaceHolder ID="SPNavigation" runat="server"> 
<tr>  
<td>    
<SharePoint:DelegateControl runat="server" ControlId="PublishingConsole"    PrefixHtml="
<tr>
<td colspan="4" id="mpdmconsole" class="ms-consolemptablerow">"    SuffixHtml="</td></tr>"> 
</SharePoint:DelegateControl> 
</td>  
</tr>   
</asp:ContentPlaceHolder>

Friday, June 22, 2007

System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0 in the sharepoint

Situation:

You have a custom ASP.NET code depolying to the sharepoint area. You have added the strong named assembly to the GAC (or) 80/bin. After the iisreset (or) application recycle you see the following error:

Security ExceptionDescription: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Reason: .NETCAS( Code Access Security) restricts the managed code at the sharepoint cost!

Fix:

Very simple than you imagined!
  1. On the sharepoint server, Go to the folder "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG"
  2. Open the config file "wss_minimaltrust.config"
  3. Under the XML section <namedpermissionsets> and under the last <permissionset> add the following:




    <IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Unrestricted="true" >
    </IPermission>
  4. You are all set. (No iisreset/app pool recycle is needed)

Monday, June 18, 2007

Sharepoint BDC search application Full Crawl error

Whenever you write a BDC search application, you follow the steps below:

  1. Write an XML application that searches using a query on one of the properties in the entity by using the "specific Finder" method against the backend database metadata specified in the XML.
  2. SSP -> Import Application Definition -> Browse -> Import.
  3. Ignore the warning message "Profile page creation skipped". It says, its not on a specific single user find and can not create a profile link in the results.
  4. SSP -> Search settings -> Content sources and crawl schedules -> New content source -> Type the name -> Select Business Data from the types of contents available -> Crawl selected app -> select your app

Now, you get the error, when you click on the "start Full Crawl" menu option from the BDC Content source just added.

Reason: There is a problem with your authentications Your current authentication doesn not have the ability to control the search service. Sharepoint Security doesnot allow Your authintications.

Incremental crawl does not work some times, if your applicaiton doesnt include the 'column' that stores the history of the crawl, that tells when was the last time the BDC crawled.

Fix:

  1. SSP -> Search settings -> Default content access account -> Enter the Id and passwrd.
  2. SSP -> Business Data Catalog -> View Applications -> Click on the Application name -> Manage Permissions -> New User -> add the same user id and pwd that you mentioned in the step1.
  3. Click on the 'Copy all permissions to descendants.( This will give permissions on the main entity and all the entities within the entiry)
  4. Sharepoint Central Admin Home page -> Operations -> Services on server -> Office Sharepoint Server Search -> Farm Seach Service Account -> Configurable -> Enter the same ID and pwd that you entered in the step1 and 2.
  5. Wait for 1 minute, as the cache will take 1 minute to load the XML metadata into the BDC object.
  6. SSP -> Serch settings -> scopes -> select the BDC scope -> start full crawl.
  7. Click on the 'refresh' until you see the 'Idle' value.

How to test the query performance and analyze

  1. This is only to test the query running or not.
  2. Go to SQL server and start the profiler to check the queries status.
  3. Start Full Crawl on the BDC scope.
  4. After you clicked on the 'Full Crawl' , you will see the queries started running in the Profiler.
  5. If you do not get the queries running, you can click on the 'View Crawl Log' or Open the sharepoint logs(12 hive\logs) to see whats wrong!

Monday, June 11, 2007

The workflow failed to start due to an internal error in sharepoint 2007.

This error is due to the workflow features messed up in the site/site collection level.
WF will be messed up due to various reasons, lets walk through the reasons and fixes.

Scenario:
I personally experienced this error, while trying to instantiate a saved template(.stp) at the site collection level (STSADM -o addtemplate).
The Site colelction from where I created the source.stp was never activated with the workflow features. Now, when I added this site collection template while creating the site collection(destination site collection) from the SCA, This destination site collection was still provisioning to the source template's features. Thus caused the error.

The other reason is due to the 'collaboration' template. When you select 'collaboration' template and try to go for the workflows you get the above error. Coz, by default, publishing through the collaboration template is prohibited.

Other reason is the security restrictions on the Infopath Form. To fix this follow the 5th point in the fix.

Fix:
  1. First of all see whether the supported workflow features( Office SharePoint Server Standard Site features - and - Routing workflow features ) are activated in the site collection level or nor.
  2. In the destination site, where the error caused, De activate the workflow related features and re activate. (Site Actions -> Site Settings -> Site Collection Features)
  3. If you can not see the workflow features in the site collection/site level, these fatures might have got scope = "farm". and Hidden = 'True'. If so, then delete the workflow eatures and add them from the STSADM command.
  4. Once you are done with the above steps, remove the workflow from the list/lib and configure it again to start over.
  5. Still no luck, time to re install the Windows Workflow foundation.
    Lodctr c:\Windows\Microsoft.Net\Framework\v3.0\Windows WorkflowFoundation\perfcounters.ini

    The reason for above WF reload is, some times the WF will be bugged while rebuilding the performance counters on the Sharepoint Server.
  6. In the case of infopath forms, increase the trust level to 'Full Trust'.

Sunday, June 3, 2007

Enable ASP.NET dubugging for sharepoint in web.config

By default, ASP.NET debugger mode is off. To turn on do the following:

  1. Log on to the application server that you want to on the debugging
  2. reach the web.config of the web application(C:\Intetpub\wwwroot\wss\virtual folders\80\web.config) . If your application is other than 80, you need to go to that folder.
  3. Replace the below node values:



<SafeMode MaxControls="200" CallStack="false" ...>
<!-- Replace this line with-->
<SafeMode MaxControls="200" CallStack="true" ...>

<customErrors mode="On" />
<!-- Replace this line with -->
<customErrors mode="Off" />

<compilation batch="false" debug="false">
<!-- Replace this line with -->
<compilation batch="true" debug="true">
If you get have the minimal trust level, you will get the following error: Unable to read the security policy file for trust level 'WSS_Medium'
Make the following change:
<!--<trust level="WSS_Minimal" originUrl="" />-->
<trust level="Full" originUrl="" />


Saturday, June 2, 2007

hosting two sites at the root of a sharepoit web application

how to co-host traditional "team" and personal Site Collections (My Sites) within an individual Web Application in Microsoft Office SharePoint Server 2007. While possible, there are several important steps that you should be aware of.

The public profile page is a document specific to the SPSMSITEHOST site template (My Site Host); unless a My Site Host is defined in the server farm, public profile pages will not be available to users.

A Web Application can have only one (1) root Site Collection, and as a result can host only one (1) site template. In a portal specific scenario, an Enterprise site template is generally applied to the root Site Collection, typically the Publishing or Collaboration portal.

To ensure the public profile page is made available to the root Site Collection, it becomes necessary to establish a web under the root Site Collection that will host the My Site Host site template.

In order to achieve this you will need to create a new web at http:/// that will host the My Site Host site template containing person.aspx.

Person.aspx is hosted in the %commonprogramfiles%\Microsoft Shared\Web Server Extensions\12\TEMPLATE\SiteTemplates\SPSMSITEHOST directory.

There are several considerations that apply to this scenario:

· The SPSMSITEHOST template must be applied to the web hosting the public profile page.

· The web hosting the My Site Host site template cannot use an existing managed path, e.g. /personal or /sites.

· The Shared Services Provider (SSP) should be configured to use the root Site Collection + My Site Host web as the My Site Host.

This can be configured under Shared Services Administration User Profiles and My Sites My Site settings Personal Site Services.

· The root web application should have the managed path /personal defined in Central Administration to maintain URL differentiation between traditional "team" and personal Site Collections.

This process will permit continuation of the typical SharePoint Portal Server 2003 configuration and Site Collection hosting model with one key difference:
· Personal Site Collections will be available to users through http:///.
· Public profile pages will be rendered to users through http:///?person.aspx?guid=.
The example scenario below illustrates a database migration approach upgrade where a root web application is selected as both the traditional "team" and personal Site Collection host:
Step 1 Upgrade the _SITE database using the database migration approach. See command line reference below:
STSADM -o -addcontentdb -url http:// -databaserver -databasename _SITE
Step 2 Upgrade the database hosting the personal site collections using the database migration approach. See command line reference below:
STSADM -o -addcontentdb -url http:///personal databaserver -databasename
Step 3 Create a new web under the root Web Application (http://) using the My Site Host template. See command line reference below:
STSADM -o createweb -url http:///public -template SPSMSITEHOST -title "Home" -description "Some Description"
Step 4 Introduce the managed path /personal to the root Web Application if it does not already exist.
Step 5 Upgrade the _PROF database using the database migration method. See command line reference below:
STSADM -o restoressp -title -url http:// -ssplogin -mysiteurl http:///public -indexserver -indexlocation "D:\Program Files\Microsoft Office Servers\12.0\Data\Office Server\Applications" -keepindex -sspdatabaseserver -sspdatabasename -ssppassword
This process is beneficial to the database migration upgrade approach in scenarios where you are upgrading the SharePoint Portal Server 2003 _SITE, profile and content databases or optionally select to establish a new SSP in your server farm. If selecting to establish a new SSP; the root web application can be created prior to creating the SSP allowing for the establishment of the new root Site Collection as the My Site Host during the SSP creation.

"Result: 404 File Not Found" while clicking the mysite or my profile in the sharepoint or people search.Person.aspx?guid=



Problem Grounds for the my site not creation error:


mysite typical URL will be http://webappname/__layouts/mysite.aspx

this URL will be used to form the my site URL for the first time. mysite.aspx page will try to create a my site at the URL: http://webappname/personal/userid/default.aspx. Remember, 'Personal' word in the above URL is reserved. If you try to play with the name, you will get error. eg, Admin will go to SCA-> application management -> managed paths and delete the 'personal' managed path.

Fix

Always remember, never delete the 'personal' wild card inclusion. This 'personal' is always of type 'wild card' inclusion. Coz, all the profiles are going to be included under this managed path. As you already know that if any managed path is going to include so many site collections, you need go for a 'wild card' managed path.


As long as the 'personal' wild card managed path is available, the url http://webappname/__layouts/mysite.aspx will always work and produce a my site.

Now we got the my site and fine with that. But, when you try to click on the 'my profile' link, you will get 404 error.


Problem Grounds for the my profile click redirecting to 404 page:

success scenario:
Lets start by analysing the successful deployed my site's 'my profile' tab button link URL :
http://webappname/Person.aspx?accountname=domain\username


In the above case, My Site Host was deployed to the root site(http://webappname/).
This is the reason why an aspx page (Person.aspx) is able to include and be browsable directly within the root.
My site settings(SCA -> SSP -> my site settings) shows the following config:

If there is a site existing at the root site not with the 'my site host' template, problem will arise.
Administrator has to plan for the 'my site host' site at the root site always.
    So, following are the possible reasons.

  • There is a site created with a non 'my site' template(i.e team/publishing) at the root site.

  • There is no personel site provider specified in the SSP - > mysite settings.

  • SCA Admin created a my site host at http://servername:1234, but changed the personal site provider URL in the SSP -> mysite settings.
    i.e, yo Admin changed the path of Personal Site Services from http://ServerName:1234/ to http://ServerName:80.
    The site collection to which he moved the personal site provider, already has a site template(team/publish) applied to it.


  • Any of the above scenarios, if a user connects to a My Site personal site that the user created in Microsoft Office SharePoint Server 2007 and even though my site is created success fully , user will get displayed with the 404 error when clicking on the my profile link. Even the people serach scope will fail so. Coz, when you select 'people' from the scope and type the people name, possible matching users are displayed in the search results. Now, if you see the navigation link by clicking on the user name, it will be pointed to http://webappname/Person.aspx?guid=some number123445tyuuii776565
Work around:

Check whether any team site/publishing site exists at the 'http://sitename/' location.
If there is no site, then create a my site host. If there is a team/publishing site existing, then follow the below procedure.

All we need to get is the URL structures,
  1. http://webappname/personal/userid/default.aspx.
  2. http://webappname/ExclusiveManagedPath/Person.aspx?guid=some number123445tyuuii776565
As long as you have a wild card managed path named 'personal' , and if you have mentioned 'personal' in the 'Location' text box in the my site settings(SSA -> serach setings) you are fine with the first URL.

To achieve the second URL, follow the below procedure:
  1. create an exclusive managed path
    SCA -> application management -> define managed paths -> type a name (e.g. mypath) -> select "exclusive" in the inclusion. Click OK.

  2. SCA -> application management -> create site collection -> select the web application you want -> select the managed path that you created in the step1(eg. mypath) -> select the 'enterprise' tab and select the

  1. Under Shared Services Administration, click Shared Service Provider (SSP).


  2. On the home page, click My Site settings under User Profiles and My Sites.


  3. On the My Site settings page, type the URL of the included path in the Personal site provider box in the Personal Site Services area.
    Configure the options that you want for the other settings, and then click OK.


Note: If you have amy mysites already built, then you need to move the locations by stsadm command.
STSADM.exe -o backup & STSADM.exe -o restore



Possible Errors:



Error: "There has been an error creating the personal site" message:



Reason: The account that the My Site applicaiton pool is running under doesn't need any special Windows permissions. But it will need the dbcreator role in SQL Server.

Fix: So, change the identity of the my site application pool to an account that has the dbcreator role.

Sharepoint Search - Can't see "All Sites" or "People" from the drop down list when search

Change the results display page

Site Settings -> site collection settings -> search settings
  1. The second radio button option "Do not use custom scopes. Display results in the search results page (/_layouts/osssearchresults.aspx)." is meant for the "This site" entry in the drop down.
  2. The forst radio button option "Use custom scopes. Display richer results using the following Search Center:" is meant for custom drop down items like "people" and "All sites" options.
  3. To select this option, you need to have a "search center" team site. this team site will be created automatically if you have enterprise sharepoint edition, if you do not have enterprise version, create a search center site. ( site actions -> Create -> website -> Enterprise tab -> search center with tabs)
  4. Once you get the site, get the URL copied and pasted into the "Do not use custom scopes. Display results in the search results page (/_layouts/osssearchresults.aspx)." option text box.

Sunday, May 27, 2007

sharepoint storage statistcs and limitations

  • Under a managed path a Web Application can support up to 150,000 site collections (site collections are likely to be spread across multiple content databases).
  • 125 host header configuration site collections.
  • A single site collection storage requirements would exceed the recommended 100 Gb max content db size
  • Multiple site collections can share a content db but the db should not exceed 100Gb.
  • more than 100 managed paths would cause performance issues. If you copy a content database to another farm you must have the same managed paths in the other environment or else you will not be able to resolve the sites.

Monday, May 21, 2007

URL Redirections for sharepoint from IIS

Vanity URLs:

You can map a short URL(http://sales/) to a long URL(http://International/US/sales) from the IIS.


  1. Create a New Virtual Directory(site) with the short name you want(http://sales/)
    Keep all the default values in the wizard.

  2. After creating the new site, go back to the IIS and right click on the newly created Website(http://sales/) -> Properties -> Home Directory -> select the "A redirection to a URL" radio button -> type the big URL(http://International/US/sales).

Each time the user types http://sales/ in the browser, the application pool assigned in the IIS will get invoked and assigned as the resources. Thus wasting the part of application pool for an unwanted. Although you are done with the redirect, you may follow the below steps to utilize the resources to the best.



  1. Create a new Application pool in IIS.(right click on the application pools -> New)

  2. Name the application pool and complete the wizard.

  3. right click on the application pool created -> Properties -> Performance -> Shut down the worker process after being Idle for -> 1 minute.

  4. Go back to the Websites -> right click on the website redirect -> properties -> set the new application pool to be used.

Redirect from a Sharepoint Page:


If you want the user to automatically redirect to a new destination page(http://newserver/newsite/page2.aspx) from the old page (http://oldserver/oldsite/page1.aspx), you need write the following meta tag inside a content editor webpart on the page1.aspx.

Moss Redirect Content Type:


MOSS publishing pages by default have 'redirect' pages associated. If you see the 'New' toolbar menu on any publishing site's 'Pages' document library, you will find the redirect page. Create the page -> edit properties -> set the destination URL. you are all set.


This feature is not available in team sites.







Configuring the InfoPath Forms Services in sharepoint 2007

InfoPath Forms Services provides you with the ability to deploy your organization's forms to Microsoft Office SharePoint Server and enable users to fill out these forms using a Web browser

Custom form templates that contain form code, require full trust, or use a data connection managed by a server administrator must be approved and deployed by an administrator. Such form templates are called "administrator-approved form templates".

If a form template does not contain form code, require full trust, or use a data connection managed by an administrator, you can configure InfoPath Forms Services to permit users to deploy such form templates, called "user form templates," without administrator approval.

Configure the Admin approved InfoPath Forms Services at the Farm level:

Start -> Administrative Tools -> SharePoint 3.0 Central Administration
-> Application Management -> InfoPath Forms Services -> Configure InfoPath Form Services
-> User Browser-enabled Form Templates section:



  • Select the Allow users to browser-enable form templates check box to allow users to deploy browser-enabled form templates.
  • Select the Render form templates that are browser-enabled by users check box to allow browser-enabled form templates deployed by users to be rendered in a Web browser. If this option is not selected, users can still deploy browser-compatible form templates, but these form templates are not accessible through a Web browser.

Data Connection Timeouts Section:

  • Set the default data connection timeout. Can override to any value lesser than this from the code
  • Set the Maximum data connection timeout. Can override to any value lesser than this.

Data Connection Response Size Section:

  • Data Connection responses size exceeding the value specified here causes the error.

HTTP data connections Section:

  • If you hace SSL setup, then only select the Require SSL for HTTP authentication to data sources box.

Embedded SQL Authentication section:

  • select the Allow embedded SQL authentication box to allow forms to use embedded SQL credentials. Forms that connect to databases may embed SQL user name and password data in the connection string. The connection string can be read in plaintext in the universal data connection file associated with the solution, or in the solution manifest.

Authentication to data sources (user form templates) section:

  • select the Allow user form templates to use authentication information contained in data connection files box to allow user form templates to use embedded authentication information such as an explicit user name and password or a Microsoft Single Sign-On application ID.

Cross-Domain Access for User Form Templates :

  • select the Allow cross-domain data access for user form templates that use connection settings in a data connection file box to allow user form templates to access data from another domain. By selecting this, we can bind a contol on the form located in Site A to a sharepoint list column located on the Site B.

Thresholds section:

  • specify the thresholds at which to end user sessions and log error messages. Form operations that exceed these thresholds will terminate the user session, resulting in the loss of all form data entered during the session, and generate an error message.
  • In the Number of postbacks per form session state box, type the maximum number of postbacks you want to allow. The default value is 75.
  • In the Number of actions per postback box, type the maximum number of actions per postback you want to allow. The default value is 200.
Form session state:



  • All the default settigns would work most senarios. To learn more about this sessions, see my blog 'Understanding InfoPath session state'.
  • In the Active sessions should be terminated after text box, type the maximum session duration in minutes. Form-filling sessions that exceed this value will terminate, an error message will be generated, and all form data entered during the session will be lost. The default value is 1440 minutes.
  • In the Maximum size of form session state text box, type the maximum session state size in kilobytes. Form-filling sessions that exceed this value will terminate, an error message will be generated, and all form data entered during the session will be lost. The default value is 4096 kilobytes.
  • In the Select the location to use for storing form session state section, choose
    Session State Service (best for low-bandwidth users)
    Store session state data on the computer running Microsoft SQL Server

    Form view (reduces database load on server)
    Store session state data on the client computer. If form session state is larger than the value specified in the associated text box, the Session State Service will be used instead.
  • In the associated text box, type the session state size in kilobytes at which form view will be automatically transitioned to the Session State Service. Once this threshold is reached, session state data will be saved to the SQL Server database, and the session will continue to use the Session State Service. The default value is 40 kilobytes.
Click OK.

Till here we are done with the Farm level configurations.
Now, lets look at the
Site Collection/Site level config:

Now that you have done with the fam level setttings, activate the 'Office SharePoint Server Enterprise Site features' feature in the sharepoint central admin and the site that you want to deploy the infopath form to be available.

Open the InfoPath form designer and design a form. Select the Browser settings in the form and apply full trust. In the publishing form wizard, check the 'Enable this form to be filled out by using browser' option that enables the 'administrator approved form template' radio button. Select the radio button and publish to a location where the fam admin can access on the file share.

Add the template to the central admin by uploading the .xsn file.

Now all we need to do is to to enable the form template available in the central admin to be available to a site collection.

Start -> Administrative Tools -> SharePoint 3.0 Central Administration -> Application Management -> InfoPath Forms Services -> Manage form templates
  • Select the form template you want to apply and click on 'Activate to a Site Collection'.
    (Check the default web application/site collection names. You can change the web app/site collection by clicking on the 'change' drop down and select the needed.
  • Now, we made the template available to the site collection.To activate a form template to a site collection, go to the site Actions - > Site Settings -> Site Collection Admin -> Site Collection Features -> Find the named template and click on 'Activate' button.
  • Now the form will be available in the 'Form Templates' library in the site collection.

Updating the administrator-approved form templates:

Each administrator-approved form template is uniquely identified by its embedded uniform resource name (URN). So each time you change/create an infopath form in the design mode and ty to upload in to the Farm level form templates, if the new template name is not matched in the exisiting old form templates, it will crate a new template and assigns a new URN(New form upload scenario). If any name matched, sharepoint compares the available template's URN with the new template's URN being uploaded.

  • If the New template URN is less than or equal to the Old emplate URN, the upload process will fail and error message will show the failure message.
  • If the New template URN > Old template URN
    You will have 4 options:

    Option 1. Allow existing browser-based form-filling sessions to finish using the current version of the form template.

    Option 2. Terminate existing browser-based form filling sessions. This approach is useful in the event that a form template is found to contain a serious bug or security issue, and you want to make the form template unavailable immediately.

    Option 3. Perform a gradual upgrade, in which you upload the new version as a separate form template, and eventually remove the old version when it is no longer being accessed by users. This is a useful approach when your form template is accessible as an embedded form or through a link on a Web page, and you are not concerned about the possibility of the old version being accessed during the upgrade process. With both form templates available on InfoPath Forms Services, you can modify the link to the form template on your Web page.

    Option 4. Quiesce the form template before upgrading to the new version. When you quiesce a form template, you gradually transition a form template from an active to an inactive state. This upgrade method is useful when you want to ensure that a form template cannot be accessed after a given time.

How to quiesce a form template:
SharePoint Central Administration -> Application Management -> InfoPath Forms Services -> Manage form templates.

  • In the Manage Form Templates page you will see a Status column. Form templates that are available to users will be designated as Ready.
  • Point to the file you want to upgrade, click the arrow that appears, and then from the menu select Quiesce Settings.
  • Type the number of minutes you want the quiescing process to take. On a production system, you should quiesce the form for at least as long as the session state is configured for the server. By default, session state is configured for 240 minutes.
  • Click Start Quiescing. In the Quiesce section, the status changes to Quiescing.
  • To see whether your form has successfully quiesced,
    Application Management tab -> InfoPath Forms Services -> Manage form templates.
    On the Manage Form Templates page, in the Status column, form templates that you have quiesced will be designated as Quiesced.
    After the form template is quiesced, you can deploy the upgraded new version of the form.


Ref:MSDN KB

Sunday, May 20, 2007

"Updating the Content Type Fialed" Error in Sharepoint

Situation:

While trying to re publish an Infopath form library encounter the error "Updating the Content Type Fialed".

Reason:

When you re publish an Infopath form template to the InfoPath form library, the template will call 'lists.asmx' webservice to convert the web enabled Infopath fields to a shrepoint form library. This web service was hard coded to expire in 30 seconds. Thus the time between the publish button click and error message "Updating the Content Type Fialed" will be 31 seconds.
This 30 seconds delay may be caused by many factors.

  1. So many columns being published to the form library.
  2. Poor network pace.
  3. Poor SQL server pace.
Fix

If you have Network/SQL server issues, catch the admin.
For library column contraint, follow this fix:

  1. Open the Infopath form template in a design mode.
  2. File -> Publish -> “To a SharePoint server” -> Destination library URL ->
  3. Next -> “Document Library” -> “Update the form template in an existing library” and choose the library from the list.
  4. This step is the trick.
    next screen, you’ll have the option to add your columns. When you click the “Add” button, instead of opting to have InfoPath create the column for you (i.e. the “None: Creat the new column” option), select the “This document library” option from the first drop-down, then select the appropriate column name from the second drop-down box .
    Initially you will not have the column name available in the drop down. You need to crate the desired column in the form library before you could start the step 1.

If you still have the error, remove some un wanted columns being published to the form library. That will reduce the publishing time.

Tuesday, April 10, 2007

'The server could not complete your request' error in sharepoint designer

Problem Definition:

While editing the content editor webpart, you get the javascript error 'Cannot 'The server could not complete your request' . Some times it allows you to get in to the SPD, upon saving the content, it throws 'Cannot save your changes in sharepoint'

Reason:

Some times, you try to edit pages in SPD, you try to edit the HTML/script in some format that is not understandable to sharepoint'. Though it saves the script , some times throw the error. At this time application pool is currupted with the invalid formats. So, if you open the SPD again, server throws the error 'The server could not complete your request' .

Fix:

Recycle the application pool.go to IIS -> web sites -> right click on the application pool -> recycle.

Saturday, April 7, 2007

"Error code is: -2147418113 while uploading large content to the doc lib in sharepoint

It may possible the SSO or any other service to break after the time out reached in the upload.
After the the break, application pools take time to recover or dead in the state, causing un expected error. Sharepoint log (12 hive\logs) shows the "Error code is: -2147418113' code.

Work Around: Go to the Application pool in the IIS, right click and recycle the pool.
Still not solved, IISRESET. Further error, edit the SSO to be manual.

Tuesday, March 27, 2007

Can not save your changes error while editing the content editor webpart

Scenario:
After Editing the CEWP, clicking on the 'OK' , throws 'Can not save your changes' errror.

Fix:
After looking at the error log, do the following options.

  • IIS Reset.
    If you think IISReset can cause the whole application to halut for some time, Do the Application Pool recycle.
    Start->Admin->IIS -> Local computer -> Application pool of the web application -> rightclick ->Recycle application pool.
  • Check for the SSL issues. To know whether the error is due to the SSL or not, access the site with the URL: http://LoadIPAddress/sites/sitecollection/site and try to edit the CEWP. If success, check for the IP address map in the IIS(richt click on the webappp -> Properties) and make it to 'Un Assigned'. Still not succeeded, check with the SSL settings.
  • Check the memory status of the DataBase SQL server. If it is less, increase the size.

Wednesday, March 21, 2007

Run stsadm command from any path

Every time you try to run the STSADM command, you always need to change the current command directory path to C:/ProgramFiles/.../12/Bin . To avoid that, do tha following thing. This will be helpful for the bulk shell scripts exetion wth the .

Control panel > System > Advanced system settings > Environment Variables >
Locate the “System Variables” section and select "Path" > Click edit.

Append the below string at the end of the line:
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\BIN

Thursday, March 15, 2007

list does not exist error on a publishing site

Problem:
SiteCollection administrator/designers/approvers do not see this error.
Any normal user(including the full control/site owner gropu user) accessing any page in the site gets the error: The page you selected contains a list that does not exist. It may have been deleted by another user. Troubleshoot issues with Windows SharePoint Services.

Reason 1:
Here the list is not a normal list. It is the 'Masterpage gallery' list. This error is due to the fact that all the users/groups are not added to the 'Master Page Gallery' by default. This happened to me after activating the publishing feature to a collaboration site.

Fix 1:

  1. Go to the master page gallery associated with the site. http://sitename/sites/site/_layouts/sitemanager.aspx
  2. Click on the 'master page gallery' context menu -> Edit Properties -> Permissions for this document library -> add the group/user with contributor access. Read access also fine

Reason 2:

The page layout/master page is checked out or in approval state pending.

Fix 2:

Open the site in sharepoint designer and check-in/approve the masterpage/page lay out.

Saturday, March 10, 2007

DVWP issue with site template

Data View WebParts are binded with the site names implicitly. So when you create a site template out of the site that has the DVWP, there will be an issue. New sites provisioned from the site template will fail to load due to the reason that the site name is different.

Fix:
Replace the code with the following. In the below code, replace the 'Your List name' value with your actual list name.

< SelectParameters>
<WebPartPages:DataFormParameter PropertyName="ParameterValues" ParameterKey="ListName" DefaultValue="Your List name" Name="ListName">




<DeleteParameters> <WebPartPages:DataFormParameter PropertyName="ParameterValues" ParameterKey="ListName" DefaultValue="Your List name" Name="ListName">


<UpdateParameters> <WebPartPages:DataFormParameter PropertyName="ParameterValues" ParameterKey="ListName" DefaultValue="Your List name" Name="ListName">


<InsertParameters> <WebPartPages:DataFormParameter PropertyName="ParameterValues" ParameterKey="ListName" DefaultValue="Your List name" Name="ListName">


<parameterbindings> <ParameterBinding Name="ListName" Location="None" DefaultValue="Your List name"/>

<ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>

<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>

<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>

Friday, March 9, 2007

Backup and Restore in MOSS 2007

Central Admin:
Central Administration -> Operations -> Perform a Backup

STSADM:
Backup a site collection:
stsadm –o backup –url -filename
Restore to a site collection:
stsadm –o restore –url -filename
you can not backup or resore a single site using above command.
Backup a single site
stsadm –o export –url -filename
Restore a single site
stsadm –o import –url filename
export/import may miss some functionality.. so double check.

Database backups:
This is probably the approach you will end up using most often. SharePoint stores all its data in SQL Server. Also, a site, or site collection, is nothing but data. Thus it is reasonable to assume that this data, can be easily backed up and restored using standard SQL Server mechanisms.
SharePoint stores its data in content databases. A single website can have a number of content databases, and a content database can contain one or more site collections. In other words, you cannot scope a content database to a single site or single list level.
You can view all the content databases associated with a given web application under central administration à Application Management à SharePoint Web Application Managementà Content Databases. This can be seen as below:

From this screen, you can add or remove content databases to a given web site. When you add a content database, you have the facility of specifying a database server and a content database name. If the database already exists on the server, it will be used as is. If in case the database does not exist on the server, it will be created for you by the farm account.
You can use this behavior to your advantage to backup restore web sites. In order to backup a web site, you simply backup all the content databases associated with the web application. In order to restore a website, you restore the content databases, and perform the extra step of specifying new site collection administrators in the new environment.
This is a fairly robust mechanism of backing up and restoring your SharePoint environment and I suspect that in any serious installation, this is what you will end up using the most anyway. This by far, however is not enough. Depending upon the specific needs of your SharePoint environment, also want to invest in the following:
Backup the entire 12 hive (c:\program files\common files\microsoft shared\web server extensions\12). This is because, frequently you will deploy code to your SharePoint farm, and you will need to restore the supporting physical files for the site to work properly.
You need to keep monitoring the size of your content databases. If you start hitting the 50GB mark, think of splitting them up, so the backups are done overnight before users start hitting the database in the morning.
Backup the entire INETPUB directory.
4. Always maintain a path to restore the current state of the production environment as various releases are pushed into production. This can be achieved by following the below recommendations:
a. Always use a scripted deployment process with clear instructions for deploying code to production. Give special attention to ensuring releases capable of taking your SharePoint installation from one version to another. With various releases, your scripts and instructions should be capable of taking a fresh SharePoint installation to the current production state.
b. Always deploy custom code as solutions, not fragile xcopy scripts.
c. Backup source control databases, and establish a strong version control policy for all code that goes into production.
d. Document all customizations and administration done under central administration for every release.
e. Follow standard disaster recovery best practices, such as regular and verified backups, off-site storage etc.
f. Backup Shared Service providers and Central Administration using stsadm after every significant configuration change or production release.
Backing up shared service providers
You can backup and restore an SSP in a mechanism similar to restoring any other SharePoint website. You must however perform the additional step of associating the SSP with the appropriate web applications after such a restore has been performed. This may be achieved using the following steps.
Under central administration, click on the “Shared Services Administration” on the left side of the page.
Once on the “Manage this farms shared services” page, click on “Restore SSP”.
Now assuming that you have already restored the SSP on a site, complete the required fields on the page shown. Just make sure that you specify the restored web application and database that the SSP site has already been restored to.
Backing up search
Search is probably the weirdest portion to backup on a SharePoint installation. First of all, given the additional complexity that backing up search requires, it might be a good idea to go with rebuilding the indexes for small or even medium sized farms. However, if your search database is huge, and your farm is quite big, and you need search to be online shortly after a disaster, you will need to look into an appropriate strategy for backing up search.
The reason backing up search is different than other portions of SharePoint, is because of how search works. Search data is stored in two locations, the search database, and the index files on the disk. You need both in order to be able to successfully serve search queries. Not only both, but you need both of them backed up concurrently for the restored versions to work together. In other words, if the search index was backed up 5 minutes after the search database, the index entries created in the additional 5 minutes will cause inconsistent results in the restored search.
In order to ensure this consistency, you should backup search using SharePoint 2007’s backup tool, or a third party product.

Tuesday, March 6, 2007

Change a MOSS site logo and image

By Default, MOSS will show a site logo and image.
Procedure to override this images:
  1. Open the Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\IMAGES directory.
  2. Copy the images that you want to appear on the home pages of your Web sites to this directory.
  3. Remove the image files TITLEGRAPHIC.GIF and HOMEPAGE.GIF, which contain the logos used on the left and right sides of the home page, respectively.
  4. Rename the new image files TITLEGRAPHIC.GIF and HOMEPAGE.GIF.
    All sites now display new logos on their home pages.

Thursday, March 1, 2007

Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information.

I got this error while searching a 'Yes/No' field in correctly.
  1. I setup a managed property "ExtraInfo" in the SSP on a 'Yes/No' crawled property.
  2. After a full crawl, I tried to search the managed property with a string "ExtraInfo:Yes"

got the error: Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information.

Fix:

  1. Search "ExtraInfo:true" instead of "ExtraInfo:Yes"
    Sharepoint crawler indexes the value with the internal boolean values "true/false".
  2. If you are searching for a vaue using the custom code in SPQuery, use '1' and '0' instead of 'yes/no' or 'true/false'.
    SPQuery goes with the crawled content with '0' and '1'.

Thursday, February 22, 2007

InfoPath error: The server is running InfoPath Forms Services, but the compatibility settings for this form template is InfoPath only

Issue:
While publishing an InfoPath form, you wil get an error "The server is running InfoPath Forms Services, but the compatibility settings for this form template is InfoPath only".

Reason:
This issue is due to the reason that InfoPath form was not configured that it can be opened on browsers also. You need to go to the form template and modify the settings to open the infopath form in a browser or InfoPath applicatoin. If you do not configure the below settings in the fix, forms will be always opened in the InfoPath application on the client. If the user do not have InfoPath installed on his machine, he will get the error. If you have a requirement that the form needs to be open in the InfoPath only, then just ignore this fix.


Fix:
Go to the form template(.XSN) and do the following:

1. Tools -> Form Options
2. Select "Compatibility" from the categories on the left hand quick launch
3. Check the option "Design a form template that can be opened in a browser or InfoPath".
4. click OK

Thursday, February 15, 2007

An error has occurred while accessing the SQL Server database or the Office SharePoint Server Search service

Problem:


  1. While accessing the User Profiles and Properties page in a SSP, you get the error: "An error has occurred while accessing the SQL Server database or the Office SharePoint Server Search service. If this is the first time you have seen this message, try again later. If this problem persists, contact your administrator."
  2. While accessing the "Search Settings page" in a ssp, you get the error :
    "Insufficient memory to continue the execution of the program"

Fix:


  1. Try to access the search properties page in SSP.
    If you get "An indexer is not assigned to the Shared Services Provider" error, then do the following:
    Application Tab -> Create or Manage this farm’s shared services -> SSP context menu -> Edit Properties -> Assign the proper index server.
    If you have an Index server already assigned, then go to step 2.
  2. Restart the search service on the Index server and all the WFEs.
    Start -> Run
    net stop osearch
    net start osearch
  3. If you are still in the woods, check whether the Search crawler account has enough permissions access on the DB.
    -Step1: Central Administration > Operations > Services on Server > Office SharePoint Server Search Service Setting -> Note down the Farm Search Service Account
    - Step2: Go to Central Administration > Shared Services > Personalization services permissions -> add the account that you noted in the first step with Manage Uer Profiles and manage Permissions.
  4. If you get this issue after you just restored the farm, then open the config db table in the SQL server and look for the record that contains the id "1AAB936C-E65C-4829-9683-5CCF5BAB90B0" that points to the search service. If you do not get to see this record then insert a record with the same id and name.

Cannot connect to the configuration database Sharepoint page and central administration

Problem Definition:


Sharepoint page throws 'Cannot connect to the configuration database'
Error :


Reason:




backend database is down or authentication failed.




Fix:




To fix this problem, you need to know the database server's name. If you know the server's name, you can skip the below and follow the step 1.




Database server name will be specified on the Sharepoint central administration's home page. But, if this error occurs, SCA will be also down. So the only way you will come to know is through logs. Default location of the logs is 'C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Logs'




In the logs, you will see some thing like this:




Critical Cannot connect to SQL Server. 'Your DB server name' not found. Additional error information from SQL Server is included below. [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. OWSTIMER.EXE (0x09C4) 0x127C Windows SharePoint Services Database




System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)




Once you got the server name, follow the below steps:




  1. Check whether the database server is down. If it is down, start the server.


  2. Check whether Database server's MSSQLSERVER service is stopped. If stopped, start the service
    Start -> Programs -> admin tools -> Services -> MSSQLSERVER -> Right click -> Start
    (Note: Some servers will have MS$SHAREPOINTSERVER)


  3. Check whether the MSSQLSERVER service id/pwd is same as the sharepoint Application pool identity or not.

    steps to know the MSSQLSERVER identity:
    Start -> Programs -> admin tools -> Services -> MSSQLSERVER -> Double click -> Logon

    steps to know the Application Pool identity:
    Start -> Programs -> admin tools -> IIS ->right click on the specific application pool that your application is running on -> Properties -> Identity

    If these two Id/pwds are not same, then make it same.
    Also check whether the password is expired/changed.












Wednesday, February 14, 2007

Cannot Retrieve Properties at this Time and Cannot save your changes in sharepoint

Problem Definition:

While editing the content editor webpart, you get the javascript error 'Cannot Retrieve Properties at this Time'. Some times it allows you to go to the rich text editor or source editor, upon saving the content, it throws, 'Cannot save your changes in sharepoint'

Reason:

Some times, you try to copy the text from Word pad to Sharepoint content editor webpart. In this process, you try to copy some format that is not understandable to sharepoint's CEWP. Though it saves the text some times, some times throw the error. At this time application pool is currupted with the invalid formats. So, if you come to the same CEWP, server throws the error 'Retrieve Properties at this Time'.

Fix:

look at the log and decide which one suits

  1. Recycle the application pool.
    go to IIS -> web sites -> right click on the application pool -> recycle.
  2. I heard it some where, not sure.. u can try..
    web.config -> go to http modules tag and delete the 'Clear' tag.

  3. look at the ISA settings.

Wednesday, February 7, 2007

unable to update the information in the microsoft office document shared documents

Sitiuation:

While selecting 'Edit Properties' from a document's context menu or adding a document to the lib, this error occurs.

Reason:

There are so many reasons, main reason is sharepoint is not capable of changning the metadata of a file due to the metadata is being locked down!

Microsoft documents' metadata gets locked due to any one of the following reasons:

  1. Document is placed to a sharepoint library from another LOB application automatically.
  2. Document is checked out to some other user.
  3. Document is checked in using a different version (eg.DOCX), thus causing an invalid property promotion/demotion.


Fix:

  1. First of all avoid uploading more than 5 MB size doc in the lib.
  2. Down load the document from the doc library to the local desktop location.
  3. Rename/Change the desired metadata that you wanted to edit.
    File -> Properties -> Custom Properties -> choose any property like client and
    type any value -> Add -> Close the dialog -> Save the document.
  4. Upload the changed document back to the doc library.
  5. If you still face the problem, then check whether MSXML 6.0 is un-installed.
    If its un installed, re-install !


Thursday, February 1, 2007

Contact Selector in InfoPath 2007

Procudure to create a Contact selector in InfoPath 2007.


  1. Open an infopath form in the design mode.

  2. Design Tasks -> Controls -> Add or Remove Custom Controls(locate this link at the bottom of the pane) -> Add -> ActiveX Controls -> Next -> Contacts Selector.-> next -> Don't include a .cab file -> Next -> Value -> Next -> From the Field or group type box choose Field or group (any data type)(*This is very important*)
    Click Finish
    Now the content selector control will be diplayed in the controls section.

  3. Now you need to create a schema that will host the Contact selector that we created in the above section.

    Design Tasks -> Data Source -> Select the 'myFields' and click on the Add a Field or Group(located at the bottom of the pane, under 'Actions'):
    Name : whatever you want (In my case, I named it as 'Grp_Contact_Selector')
    Type : Group
    OK. ( Do not check the 'Repeating' check box).

  4. Design Tasks -> Data Source -> Select the group name that you just created -> click on Add a Field or Group-> add a repeating 'Group' and name it 'Person'
    Name : Person
    Type: Group
    Check the 'Repeating' check box.
    OK.

  5. Select the 'Person' Group field and click on the Add a field or group, add 3 repeating fields under the 'Person' Group named 'DisplayName' , 'AccountId' and 'AccountType'.

    A. Creating the 'DisplayName' repeating field

    Select the 'Person' group, click on 'Add a field or group'
    Name: DisplayName
    Type: Field (element)
    Data Type : Text (string)
    Check the 'Repeating' check box.
    OK.

    B.
    Creating the 'AccountId' repeating field
    Select the 'Person' group, click on 'Add a field or group'
    Name: DisplayName
    Type: Field (element) Data
    Type : Text (string)
    Check the 'Repeating' check box.
    OK.

  6. C. Creating the 'AccountType' repeating field
    Select the 'Person' group, click on 'Add a field or group'
    Name: Account Type
    Type: Field (element)
    Data Type : Text (string)
    Check the 'Repeating' check box.
    OK.

    Once you are done with all the fields, your data source should look like the below image:




  7. Open Notepad and type the following text within the 'Context' node:


    <Context siteUrl="http://yourservername" />





  8. Name the xml file as 'Context.xml'.


  9. Tools -> Data Connections -> add -> recieve data -> select the "XML Document" -> Next -> Click on the 'Resource Files' -> browse to the XML file that you just created and add to the data conections. Name the connection as 'Context'.
    Note: Name of the XML node in the file, Name of the data connection and name of the .XML file should be 'Context' (case sensitive).


  10. You are done! Now drag and drop the newly created Contact selector group onto the form. In my case, its 'Grp_Contact_Selector'.
    While dropping on the form, a popup will get displayed with various fields. Select the 'Contact Selector'.
    If you can't see the contact selector in the popup double check the above steps, especially the step 2.


  11. If you wanna see the selected contact selector in the infopath form library, then add this contact selector to the promoted fields(File-> publish -> site URL -> Infopath form lib name -> select 'Display Name' out of the above structure and function as 'First'. )


  12. Some times Contact Selector will grey out in the preview mode but you will be able to edit it in the actual 'New' Form.

Multiple Contact Selectors in Infopath 2007:
If you wanna have two or more contact selectors on a signle form, follow the below Procedure:





  1. Create the actual format of the Contact Selector Groups schema(Grp_Contact_Selector) directly under the myFields. We are done creating the 'Grp_Contact_Selector' group in the ablove section. So, I am not repeating the procudure here.

  2. Our goal is to create two more groups as the same hierarchy showed in the above picture, besides the original master contact selector group(Grp_Contact_Selector).
    To create the above hieracrchy shown in the figure follow the below procedure.

  3. Create two non repeat groups directly under the 'myFields'. Name it whatever you like. In my example, I named 'Grp_Proj_Manager' and 'Grp_Requester'.

  4. richt click on the master schema group 'Grp_Contact_Selector' group -> 'Reference' -> Browse and select the first folder i.e 'Grp_Proj_Manager'.
    (Now all the original master contact selector nodes hierarchy is copied under the 'Grp_Proj_Manager' group).

  5. richt click on the 'Grp_Contact_Selector' group -> click on 'Reference' -> Browse to the second folder i.e 'Grp_Requester'. (Now all the original contact selector nodes hierarchy is copied under the 'Grp_Requester' group).

  6. Now that you have two contact selector schemas under two different groups.
    All you need to do is to drag and drop the first group's referenced contact selector template (in my case its 'Grp_Contact_Selector') on to the designer.
    Important: Do not drag and drop the actual group 'Grp_Proj_Manager' or 'Grp_Requester' drag the referenced template instead. If you drag the actual group, there will not be any error but while filling out the form, after you select the user from the AD, contact selector field will be grayed out.

  7. Drag and drop the second group ('Grp_Requester') on to the designer.

  8. Now you have two different contact selectors that holds two names.

  9. In my example I explained 2 contact selectors. But, you can have 'n' number of contact selectors. Have fun!

Wednesday, January 24, 2007

Beginner's Sharepoint Custom webpart using Web Control Library

  1. VS 2005 -> File -> New Project ->Visual C# Projects -> Web Control Library.
  2. Name it as 'Simple Webpart' and Specify the project location.
  3. Add reference to Microsoft.Sharepoint.dll and System.XML

    (Solution explorer -> References -> right click -> Add Reference -> .NET -> search and select the name spaces above.)
  4. Add the following to the using section:

    using System.Security;
    using Microsoft.SharePoint.WebPartPages;
    using System.Xml.Serialization;
  5. Edit the AsseblyInfo.cs to preserve a fixed version each time you build.
    Replace the
    [assembly: AssemblyVersion("1.0.*")]so that it reads[assembly: AssemblyVersion("1.0.0.0")]

  6. Add the following statement in the AsseblyInfo.cs at the end.

    [assembly: System.Security.AllowPartiallyTrustedCallers]
  7. Chnage the name space so that we can have any number of webparts under a single namespace.

    Replace
    namespace SimpleWebPart
    with
    namespace MyWebParts
  8. Change the class declaration to inherit from the webpart class.
    Replace
    public class SimpleWebPart : WebControl
    with
    public class SimpleWebPart : WebPart
  9. Replace
    protected override void Render(HtmlTextWriter output)
    With
    protected override void RenderWebPart(HtmlTextWriter output)
  10. Add the code needed in the webpart, add necessary child controls you needed.
    Replace the code in the Render webpart method with
    withRenderChildren(output);
  11. Strong name the assembly
  12. Copy the dll to the 'bin' directory of the application.
    C:\Intepub\wwwroot\wss\virtual directories\port number
  13. GAC the assembly:
    Drag and drop the dll to 'C\Windows\Assembly
  14. Increase the Default Trust Level and Add a SafeControl Entry for your Web Part

    Open the web.config file in the Web application root(C:\inetpub\wwwroot\wss\virtual deirectories\port\web.config) -> In the level attribute of the trust section, change WSS_Minimal to WSS_Medium.
  15. Add the assembly to the safe controls.
    Within the web.config file opened above, locate the
    <safe controls >
    section and add the following:

    <SafeControl Assembly="SimpleWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=PublicKeyToken" Namespace="MyWebParts" TypeName="SimpleWebPart" Safe="True"/>

  16. In the above line, MyWebparts is a namespace.
    SimpleWebPart is an assembly name.
    PublicKeyToken:
    C:\Windows\Assembly\SimpleWebPart -> right click -> properties.
    (or)
    you can find the key value from the following command.
    Open the visual studio command prompt and type:
    sn.exe -T C:\inetpub\wwwroot\wss\VirtualDirectories\PortNumber\bin\SimpleWebPart.dll
  17. Open a notepad and copy paste the following lines;
    <?xml version="1.0"?>
    <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2; <Assembly>SimpleWebPart, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=PublicKeyToken</Assembly> <TypeName>MyWebParts.SimpleWebPart</TypeName>
    <Title>My Simple Web Part</Title>
    <Description>A simple Web Part</Description>
    </WebPart>


    Save the file as 'SimpleWebPart.dwp' and save at the bin folder, where the dll is copied
    (C:\inetpub\wwwroot\wss\VirtualDirectories\PortNumber\bin\)
  18. Site Actions -> Site settings -> galeeries -> Webparts -> upload -> browse to the above .dwp file.
  19. Site Actions -> Edit Page -> Add Webpart -> drag and drop the webpart on the page.