Showing posts with label MOSS 2007. Show all posts
Showing posts with label MOSS 2007. Show all posts

Sunday, August 23, 2009

Sharepoint PropertyBag

Sharepoint comes with handfull of option to store the information with ease.When we are thinking about storing configuration information then first item comes to our mind is web.config.But when we look at sharepoint perspective, there is one more usfull option called propertybag is available.It can store the information at different levels such as


• Farm
• Server
• Web Application
• Site Collection
• Site
• List
So we can share the information across different web where a list failed to do that and also able to persist information across farm.

SPWeb exposes two properties to store the information one is AllProperties which equivalent to a hashtable and supports case sensitive keys.Second one is properties (PropertyBag) and no supports for case sensitive keys.
using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb web= site.OpenWeb()) {
// Add a property entry
web.Properties[key] = value;
web.AllProperties[key] = value;
web.Update();
web.Properties.Update();

// Remove a property entry
web.AllProperties.Remove(key);
web.Properties[key] = null;
web.Update();
web.Properties.Update();
}
}
We can also serialize the object and store in the propertybags.Sounds cool !!
You can download Property bag settings from http://pbs.codeplex.com/ and more details about managing configuration information http://spg.codeplex.com/Wiki/View.aspx?title=Managing%20Application%20Configuration&referringTitle=Home

Wednesday, July 22, 2009

Creating Sharepoint ContentType with specified GUID

Type contentType = typeof(SPContentType);
Type paramType = typeof(SPContentTypeId);
Type[] paramArray = { paramType };
ConstructorInfo consInfo = contentType.GetConstructor(BindingFlags.Instance BindingFlags.NonPublic, null, CallingConventions.Any, paramArray, null);
object[] paramsX = { new SPContentTypeId(contentTypeID) };
SPContentType contentTypeObject = consInfo.Invoke(paramsX) as SPContentType; contentTypeObject.GetType().InvokeMember("Web", BindingFlags.NonPublic BindingFlags.Instance BindingFlags.SetProperty BindingFlags.IgnoreCase, null, contentTypeObject, new object[] { targetWeb }); contentTypeObject.GetType().InvokeMember("Collection", BindingFlags.NonPublic BindingFlags.Instance BindingFlags.SetProperty BindingFlags.IgnoreCase, null, contentTypeObject, new object[] { targetWeb.ContentTypes }); return contentTypeObject;

Saturday, July 4, 2009

How to Create Site Coloumn- MOSS 2007

When we are developing sharepoint application its quiet common that we need to add site coloumns.So we can create our own cloumn for a share point list or document library or Content Type.Following steps will show how to create a site coloumn
Step 1. Goto to your sharepoint site and click on the site action menu (top right side)

Step 2.Click on the Site Setting Sub Menu.

Step 3.In Site settings page Go to Gallery Section and Click on Site Coloumn Link


Step 4.In Site Coloumn Gallary page you can see all the existing site coloumns.Next you have to click on the creat link in site coloumn gallery page.


Step 5.In site coloumn Create page specify the coloumn name you want to create


Step 6.Specify the type of Coloumn we are going to create.Here we are going to create a lookup coloumn.


Step 7.Specify the group under which this new site coloumn should go.You can add new group so it will help to identify the our coloumn.Give a meaning full busines group name or project name.


Step 8.Specify this will be a required coloumn.(suppose we added this coloumn into a list and saying this is required coloumn)



Step 9.Now we are going to specify our source list for theis lookup coloumn.Specify a list from the drop down.Look at my BlogHow to create list.


Step 10.Next we are going to specify which will be the coloumn in the source list being use as the source coloumn for this lookup coloumn.


Step 11.Specify this lookup coloumn supports mutiple value from the source coloumn.


Step 12.After sucessfull you will see the following screen, in which you can see the new cloumn created under a new group we specified.


Cheers
Shyju Mohan

MOSS 2007 - Creating a Site Collection

Let see how to create a site collection and base site or Top level site for site collection.

Step 1 . Go To Sharepoint Central Admin

Step 2 . Go To Application Management Tab in Sharepoint Central Admin

Step 3 .Go to Site Management section and click on Create Site Collection


Step 4 .In Site creation page Select the Web application in which site is going to run.So it will use the same content DB of the specified web application.

Step 5 .Specify the title for the site.So that name will come as the site title.

Step 6 .Specify the URL for the site.If it is not base site then specify some meaning full name.


Step 6 .In this step you have to decide what kind of template i am going to use for mysite.There many template are available choose the appropriate one suites your business scenario.

Template Group Collaboration
This group contains template which suits your collboration need in your organization.Sites like Team collaboration,Wiki,Blog,Colloborative Document Workspace are available in this Group.


Template Group Meetting
This group Provides template for meeting includes basic meeting,social meeting,decision making meeting etc.


Template Group Enterprise
This group Provides template for catering some of the needs in enterprise functional need.Sites like Recod center,Report Center,Document Center etc


Template Group Publication
This group Provides template for creating publcation portal for your internet facing sites.


Step 7 .You have specify which user will be the administrator of the site.Specify the user which is going to do the administrative job for this site.


Step 7 .Specify the quota for the site.There by you can limit the growth of the site.


Step 8 .Submit the site creation form.After Successfull creation you will see following screen.


If you need to look at how to create web application Look at my BlogHow to Create Web Application

How to Create or extend Web applications

When you are playing with sharepoint first you have to create a web application to play with.Let see how we can create a webapplication in sharepoint

Step1 . Goto Sharepoint Central Admin Site



Step 2 . Goto Application Management Tab

Step 3. Click on Create or Extend Web Application Link


Step 4. Click on Create New WebApplication
In the web application creation you have to specify the different details for your Convenience.


Step 6 . Specify the port above 1500 (You can specify some port number which is easy to remeber.



Step 7 . Specify the Application Pool Name .Give some meaning full name so you can identify your application Poll easily.



Step 8. Specify the user name and password under which Application Pool is going to run(Try to Use windows Service User).



Step 9. Specify the Content DB name so you easily identify your content DB for the specific web application.By Default it will give some junk name



Step 10. Specify authentication Mode in which you want to communicate with Database.You can go for windows authentication (uses the application pool identity use) or you can specify the specific Sql Server user name and password.

Step 11. Submit the Web application creation form.

step 12 . You will see the above screen if it is successfully created.

You can see how to create a site collection in my Blog How to create site collection

Cheers
Shyju Mohan