Wednesday, April 23, 2008

Change password for sharpoint account


stsadm -o updatefarmcredentials -userlogin DomainName\UserName -password NewPassword

By using the command change the password of the farm

stsadm -o updatefarmcredentials -userlogin DomainName\UserName -password NewPassword

Then go to IIS manager of a web server.

Go to application pool of the sites which dont have network service as a application pool's identity

Change the credential for application pool identity(If it is not network service and if it is configurable )

Go to the the web sites,

Properties --> Directory security --> Authentication and access control

change the credential of the user who is used for anonymous access.

Change the password for scheduled tasks on the system(If any.)

Repeat it for all the web sites.

How to add custom people Editor sharepoint control in web page?

Simply, Add following mark up in the page.

"IsValid="true" AllowEmpty="false" Height="20px" Width="200px"
BackColor="Cornsilk" AllowTypeIn="true" MultiSelect="false"
SharePointGroup="Test_Group" />"

Monday, April 14, 2008

How to get currently running asp.net application in iis, with its process id and name?

Here is the command that helps.


 

C:\WINDOWS\system32>iisapp.vbs

W3WP.exe PID: 5080 AppPoolId: SharePoint - 82

Friday, April 11, 2008

Performance monitoring with Task Manager

http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/prork/preb_mon_nbcl.mspx?mfr=true

Tuesday, April 8, 2008

Recycling an Application Pool (IIS 6.0)

http://www.developer.com/net/asp/article.php/2245511

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/f11b8294-cc42-4e9c-8482-6257bf3b80f2.mspx?mfr=true

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/989a6b5c-289c-4a7c-95b5-175ee4c27159.mspx?mfr=true

Optimize custom Task Form or WebPage in WSS3.0 – Step By Step Approach

To optimize task form or web page in WSS,

  1. In Task form or web page, use only one SpWeb and SPSite object throught out the page. Avoide creating SPSite or SPWeb objects at multiple places.


     

  2. Always make sure to Dispose the SPSite and SPWeb objects after finish use of it. For this we can follow following coding practice as per situation.
    1. "Using" technique : This is the best technique.

      Here is the sample example for this.

void PublishingWebCollectionBestPractice()

{

using (SPSite siteCollection = new SPSite("http://moss"))

{

using (SPWeb web = siteCollection.OpenWeb())

{

PublishingWeb outerPubWeb = PublishingWeb.GetPublishingWeb(web);

PublishingWebCollection pubWebCollection = outerPubWeb.GetPublishingWebs();

foreach (PublishingWeb innerPubWeb in pubWebCollection)

{

// innerPubWeb referenced so we must call outerPubWeb.Close()

// otherwise, we will leak each and every innerPubWeb object

innerPubWeb.Close();

}

} // SPWeb object web.Dispose() automatically called

} // SPSite object siteCollection.Dispose() automatically called

}

  1. "Finally" – Alternative way.

    Dispose objects in finally clause.

    Here is the sample example.

String str;

SPSite oSPSite = null;

SPWeb oSPWeb = null;

try

{

oSPSite = new SPSite("http://server");

oSPWeb = oSPSite.OpenWeb(..);

str = oSPWeb.Title;

}

catch(Exception e)

{

}

finally

{

if (OurObject != null)

{

OurObject.Dispose();

GC.SuppressFinalize(OurObject);

}

if (OurSiteObject != null)

{

OurSiteObject.RootWeb.Dispose();

OurSiteObject.Dispose();

GC.SuppressFinalize(OurSiteObject);

}

}


 

  1. Whenever required to pass the SPWeb or SPSite Objects, pass by reference (ref parameter). Avoid to pass it by value. It creates multiple objects each time they pass.

        Like

SPWeb sourceWeb = sourceSite.OpenWeb();

string smtpServerName = GetSettingsValue(ref sourceWeb, "SMTPServerName", "String Value");


 


 

Other good references,


 

  1. http://www.webdeveloper.com/forum/archive/index.php/t-154151.html
  2. http://blog.gemsolution.co.uk/2007/06/15/disposing-of-spsite-and-spweb-objects/
  3. http://msdn2.microsoft.com/en-us/library/yh598w02(VS.80).aspx
  4. http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx
  5. http://support.microsoft.com/default.aspx?scid=901259
  6. http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=73
  7. http://209.85.173.104/search?q=cache:jZ-GHkoMd9oJ:blog.developers.ie/cgreen/archive/2006/09/26/2274.aspx+SPWeb.ParentWeb+%2B+Dispose&hl=en&ct=clnk&cd=8&gl=us

CLR Profiler

http://msdn2.microsoft.com/en-us/library/ms979205.aspx -- how to use CLR Profiler for monitor garbage collector.

Wednesday, April 2, 2008

Retrieve the user from people picker control

In continuation of my previous post,

Use following code needed to retrieve the user from people picker control

using
Microsoft.SharePoint.WebControls; //add a reference to Microsoft.SharePoint.dll if needed

public
class MyPage : Page
{
     protected PeopleEditor
indrajeet;

}


public void btnSave_Click(object sender, System.EventArgs e)
{
….
PickerEntity pe = (PickerEntity)
indrajeet.Entities[0]; //gets first user in list
string username = pe.Description;

}

How to add People Picker control to custom application development (ASPX, user controls or web parts)

Add the following lines of code in the form to add PeopleEditor control to your page:


 

<%@ Register
Tagprefix="indrajeet" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>


 

< indrajeet:PeopleEditor

AllowEmpty="false"

ValidatorEnabled="true"

id="usrPicker"

runat="server"

ShowCreateButtonInActiveDirectoryAccountCreationMode="true"

SelectionSet="User" />