Amazing Uncommon Facts

Q:> Why Microsoft named ISAPI folder as _vti_bin in SharePoint?
Ans:> Microsoft acquired software company called Vermeer Technologies Incorporated which is founded in 1994 and has only one product Front Page.
The _vti_bin folder was used to store the FrontPage server-side extensions. In SharePoint same is used to store the Web Services.

Q:> Why SP workflow doesn’t start automatically when item is created via object model?

Ans:> Many times we have requirement to create a task via workflow or object model and set the list setting to automatically trigger the workflow when item is created. In some scenarios we notice that item is created successfully but workflow doesn’t start. But if we create item via UI then workflow works perfectly. Here is a small tip to debug this issue.

If item is created via system account workflow will not trigger automatically. Same applies to event handlers.

Advertisements

Problem in adding external user with FBA

The forms-based authentication (FBA) provider supports authentication against credentials stored in Active Directory, in a database such as a SQL Server database, or in a Lightweight Directory Access Protocol (LDAP) data store such as Novell eDirectory, Novell Directory Services (NDS), or Sun ONE.

I had issue with form based authentication i get the below error when try to add new external user to SharePoint group.

The user or group '' is unknown.   at Microsoft.SharePoint.Utilities.SPUtility.FilterValidLoginName(String loginName, SPSite site) 
   at Microsoft.SharePoint.SPUserCollection.FilterConvertSPUserInfoArray(SPUserInfo[] userInfoArray) 
   at Microsoft.SharePoint.SPUserCollection.AddCollection(SPUserInfo[] addUsersInfo) 
   at Microsoft.SharePoint.ApplicationPages.AclInv.BtnOK_Click(Object sender, EventArgs e) 
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e) 
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) 
   at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) 
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) 
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) 
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Most of time fix to this kind of issues is correct configuration of Authentication Providers in Central administration. Same worked for me too. I followed the below two links to resolve my problem:
http://msdn.microsoft.com/en-us/library/bb975136%28v=office.12%29.aspx#MOSS2007FBAPart1_Intro

http://technet.microsoft.com/en-us/library/cc262201%28office.12%29.aspx#section1

Issues faced while upgrading SharePoint 2007 to SP2

Hi friends, upgrading SharePoint 2007 to SP2 was not an easy task for me. I almost spent more than a week to fix all the issues occurred. I am sharing my findings so you will know what kind of issues can come and how to resolve them.

Note:- Before you start the installation, you must get the correct service packs/cumulative packs  and install in correct order (install first WSS and then SharePoint SP2). After installation, you will be asked to run the SharePoint Product Configuration wizard. That is the area where your fight will start with SharePoint. Below i have list down the issues i faced and solutions as well. 🙂 For me update always failed at step 8 (seems to be big important step).

Note:- Keep your eye on event log and find for error keyword in log file generated after configuration failure. Upgradelog.txt file contain all the error details and present in “c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS” directory. Search for error count at bottom of the file (e.g. 1 errors and 0 warnings encountered.). This file is the main source and guide us to fix all issues.

Issue 1 – Unable to start the SharePoint Search service. Error was log on failure. To fix this issue you must check the service account try to run the service during configuration wizard. It uses the account which you have used to setup the SharePoint server. To reset the account click here

Issue 2 – After fixing above issue, i ran into another one. Below are the error details from upgrade.log file.

[SPManager] [ERROR] [7/18/2011 3:36:22 PM]: Pre-Upgrade [SPSite Url=http://ServerName] failed. Microsoft.SharePoint.Upgrade.SPSiteWssSequence has the ContinueOnFailiure bit set. Moving on to the next object in sequence.
[SPManager] [ERROR] [7/18/2011 3:36:22 PM]: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)
[SPManager] [ERROR] [7/18/2011 3:36:22 PM]:    at Microsoft.SharePoint.Library.SPRequestInternalClass.GetSiteQuota(String bstrUrl, UInt16& pdwQuotaTemplateID, Int64& plDiskQuota, Int64& plDiskWarning, Int32& plUserQuota)
   at Microsoft.SharePoint.Library.SPRequest.GetSiteQuota(String bstrUrl, UInt16& pdwQuotaTemplateID, Int64& plDiskQuota, Int64& plDiskWarning, Int32& plUserQuota)
   at Microsoft.SharePoint.Administration.SPQuota..ctor(SPSite site)
   at Microsoft.SharePoint.SPSite.get_Quota()
   at Microsoft.SharePoint.Upgrade.SPSiteSequence.PreUpgrade()
   at Microsoft.SharePoint.Upgrade.SPManager.Upgrade(Object o, Boolean bRecurse)

I removed the web application and started the configuration wizard again and it worked fine. (Note: I removed the application because it was empty and in my development environment. But this not be the case all the time. We must find the root cause with the help of error message and fix it.)

Some useful links: http://support.microsoft.com/kb/944267
http://code-journey.com/2009/error-when-updating-windows-sharepoint-services-3-0-with-sp2-an-update-conflict-has-occurred-and-you-must-re-try-this-action-the-object-spsearchdatabase/

Cumulative packs links: http://technet.microsoft.com/en-us/office/sharepointserver/bb735839

SharePoint 2007 Cumulative Updates and Internal Version Numbers

Modify SharePoint web.config to display error details

Enable Custom Errors: Set the customErrors mode to “Off”

Find: <customErrors mode=”On” />

Change to: <customErrors mode=”Off” />

Enable the Call Stack Trace: Set the CallStack value of the SafeMode element to “true”

Find: <SafeMode … CallStack=”false” … >

Change to: <SafeMode … CallStack=”true” … >

Enable Debugging Mode: Set batch and debug to “true”

Find: <compilation batch=”false” debug=”false”>
Change To: <compilation batch=”true” debug=”true”>

How to start the WSS Search Service via Central Administrator

When you stop and start the WSS Search Service in Central Administrator (Operations=>Services on server=>Windows SharePoint Services Search), you may get the following error:

Database_name contains user-defined schema.  Databases must be empty before they can be used.  Delete all of the tables, stored procedures and other objects or use a different database.

Follow below steps to fix this issue:

Step 1 – Stop SQL Server service

Step 2 – Delete files WSS_Search_ Servername.mdf  and WSS_Search_ Servername_log.LDF

Step 3 – Start SQL Server service

Step 4 – Restart the WSS Search Service again (Provide new name for search database, old database name might not work.)

Script to change service accounts and passwords in SharePoint Server 2007 and in WSS 3.0

Use this command to run the script file: FileName.bat DomainName\UserName NewPassword
Note: Put the exact domain/server name instead of '.' or just username

 @echo off
rem other app pools
echo *** Updating app pool passwords
"%commonprogramfiles%\Microsoft Shared\Web server extensions\12\BIN\Stsadm.exe" -o updateaccountpassword -userlogin %1 -password %2 -noadmin
rem central admin
echo *** Updating Central Admin password
"%commonprogramfiles%\Microsoft Shared\Web server extensions\12\BIN\Stsadm.exe" -o updatefarmcredentials -userlogin %1 -password %2
rem ssp - new
echo *** Updating ssp password for new installs
"%commonprogramfiles%\Microsoft Shared\Web server extensions\12\BIN\Stsadm.exe" -o editssp -title "SharedServices1" -ssplogin %1 -ssppassword %2
rem ssp - upgrade
echo *** Updating ssp password for upgraded installs
"%commonprogramfiles%\Microsoft Shared\Web server extensions\12\BIN\Stsadm.exe" -o editssp -title "Default Web Site" -ssplogin %1 -ssppassword %2
rem osearch
echo *** Updating osearch password
"%commonprogramfiles%\Microsoft Shared\Web server extensions\12\BIN\Stsadm.exe" -o osearch -farmserviceaccount %1 -farmservicepassword %2
echo *** MANUAL UPDATE NEEDED. To update the password, visit the SSP Web application page, click Search Settings, and then click Default Content Access Account.
rem spsearch
echo *** Updating spsearch password
"%commonprogramfiles%\Microsoft Shared\Web server extensions\12\BIN\Stsadm.exe" -o spsearch -farmserviceaccount %1 -farmservicepassword %2
echo *** Updating spsearch content access account
"%commonprogramfiles%\Microsoft Shared\web server extensions\12\BIN\stsadm.exe" -o spsearch -farmcontentaccessaccount %1 -farmcontentaccesspassword %2
rem restarting IIS
echo *** Doing soft restart of IIS
iisreset /noforce
echo on

Find more details @ http://support.microsoft.com/kb/934838

Access Denied error with RunWithElevatedPrivileges method

Sometime in SharePoint we need to run a piece of code under higher privileges in to achieve the target which is not possible with logged in user context. SharePoint provide us a method to achieve this which is under namespace Microsoft.SharePoint.

Method Name: SPSecurity.RunWithElevatedPrivileges

Example:

SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(web.Site.ID))
{
// implementation details omitted
}
});

In some situations we execute the code under above method but still got the access denied error. We wonder how this is possible as we are running code under user who has farm level full permissions.
Take a look at below code (looks neat right). We are trying to get the SPUser object of specific user which current user doesn’t have permissions. We should be aware when use the SPContext.Current.Web because it runs under current user context.
We must create a new SPWeb object under RunWithElevatedPrivileges method.

SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(web.Site.ID))
{
// implementation details omitted
}
});

//Wrong code: Code will run under current user context
SPSecurity.RunWithElevatedPrivileges(delegate
{
SPUser user = SPContext.Current.Web.AllUsers[“UserName”];
});

//Correct Code: Code will run under system account context
SPSecurity.RunWithElevatedPrivileges(delegate
{
using(SPSite site = new SPSite(SPContext.Current.Site.ID))
{
using(SPWeb web = site.OpenWeb())
{
SPUser user = web.AllUsers[“UserName”];
}
}
});

%d bloggers like this: