MOSS 2007 : WSS 3.0 : How do you add items into Choice Site Column type.

Here is the sample code,                 SPWeb web = new SPSite(“http://karthick64:4040/”).OpenWeb();                SPField spField = web.Fields[“MyChoice”];                SPFieldChoice choiceFields = (SPFieldChoice)spField;                string[] choices = new string[3] {“x”, “y”, “z”};                foreach (string choice in choices)                {                    choiceFields.Choices.Add(choice);                }                choiceFields.Update(); Keep Exploring… 🙂


MOSS 2007 : WSS 3.0 : How do you add a new Site Column to a Content Type using the MOSS object model?

How do you add a new Site Column to a Content Type using the MOSS object model?  Here is the sample code    SPWeb web = new SPSite(“http://localhost:4040”).OpenWeb();    SPContentType myCT = web.ContentTypes[“myNewContentType”];    myCT.FieldLinks.Add(new SPFieldLink(web.Fields[“abc”]));    myCT.Update();   Note : The following MSDN article speaks about “Updating Child Content types”. The example given…


MOSS 2007: WSS 3.0: How to add/delete/update site columns by using SharePoint WebService

SharePoint’s Webs webservice can be used to add/delete/update site columns. Unfortunatley MSDN/SDK doesnot has the sample yet. Here I provide the sample code.             //webs webservice object             localhost.Webs websService = new ContentTypeAndSiteColumn.localhost.Webs();             //url for the webservice             websService.Url = “http://localhost:4040/_vti_bin/Webs.asmx”;             //credential             websService.Credentials = System.Net.CredentialCache.DefaultCredentials;               //xmldocument object             XmlDocument xDoc…


MOSS 2007 : CMS 2002 Migration Issue : How to rename a resource Gallery Item?

Unfortunately MCMS 2002 Site Manager doesnt allow you to rename the resource gallery item. In some situation you may end up duplicate entries in the resource gallery item names. MCMS 2002 allows you to have multiple resource items with same name. The items will be differentiated by using their guids. But this will endup a…


WSS 2.0 : How to upload images by using Imaging WebService

Here you go for the sample code.                  try                 {                             //create imaging web service object                             localhost.Imaging img = new ImagingTest.localhost.Imaging();                             //set url                             img.Url = http://localhost:8081/sites/site1/_vti_bin/Imaging.asmx;                             //Set credential                             img.Credentials = System.Net.CredentialCache.DefaultCredentials;                             //for results                             System.Xml.XmlDocument resdoc= new System.Xml.XmlDocument();                             System.Xml.XmlNode resnode = resdoc.CreateNode(System.Xml.XmlNodeType.Element,”Result”,””);                                                                                            System.IO.FileStream fs = new System.IO.FileStream(“c:\\n15.jpg”,  System.IO.FileMode.Open, System.IO.FileAccess.Read);                            //Get the content                            byte[] content = new byte[fs.Length];                            //store…

WSS 2.0 : "Getting unauthorized access" error when ‘User must change password at next logon’ is enabled

Problem Background : When you enable “user must change password at next logon”, then the corresponding user will face the unauthentication issues. To resolves this, you may enable IISADMPWD for WSS How to enable the IISADMPWD for WSS? To register iispwchg.dll, follow these steps: Click START, and then click RUN In the open box type the following…


WSS 2.0 : How to enable document library eventhandlers by default

Open the Site definition folder. If you use default Site definition, STS, then open the folder from the following location. “C:\program files\common files\Microsoft Shared\web server extensions\60\template\1033\STS Note: Modifying the default files is not supported by Microsoft. Microsoft recommends using custom Site Definition. Open the List Definition folder. If you use default list definition for document…

WSS 2.0 : stsadm – can’t delete wppack with slash in its name

If you install a wppack by using stsadm with slash “/”, then you will not be able to uninstall it by using the stsadm tool 🙁 . The story not endup here, you will not be able to install the latest version of your webpart :(. However SharePoint object model helps us to resolve the problem….

WSS 2.0 : How to programmatically enable/disable the rights at Virtual server level?

To enable all rights at the virtual server level            vServer.Config.Properties[“virtualserverpermsmask”] = “-1”; To disable the “Manage Site Groups” permission at the virtual server level            vServer.Config.Properties[“virtualserverpermsmask”] = “2113867535”; Keep Coding 😉

WSS 2.0 : How to save properties of webpart from webpart code

There are two methods, SaveChanges and SaveProperties provided by WSS which sometimes misleading users. Here I provide details for which method to use and when to use. SPWebPartCollection.SaveChanges()  – This method is used to save the changes made in the web part from out side the web part code. For e.g., the console application, windows application etc.., SPWebPartCollection.SaveProperties -…