Wednesday, June 16, 2010

Creating site columns thorugh SQL query

Sometimes, you may feel pain while creating site columns and content types through CAML, because you need to know CAML syntax for each and every site column data type, but you can avoid this by simply running one sql queryNormally in SharePoint when we create any site column or content type through SharePoint user interface that will go and stored into content database in the form of CAML, so we can run simple sql query and get that data and build it into features and deploy the same in some other environment means productionSteps1. create sitecoumns...

Friday, June 11, 2010

Access denied error when code runs with SPsecurity.RunWithElevatedPriviliges

Today, while reviewing code ,I have found some thing, which will give access denied error if our code runs with SPSecurity.RunWithElevatedPriviliges and AllowUnsafeUpdates = trueCheck the piece of code which I have written below that gives access denied errorusing (SPSite site = new SPSite(SPContext.Current.Web)){SPList list = web.Lists[listUrl];SPFieldCollection fieldCol = list.Fields;SPListItem newItem = list.Items.Add();foreach (SPField field in fieldCol){if (!field.Hidden && !field.ReadOnlyField){if (field.Title.Equals(question, StringComparison.OrdinalIgnoreCase)){newItem[field.Title]...

Sunday, February 28, 2010

Another reusable component - Site Columns and Content Type generator

I have seen so many people struggling to create sitecolumns and contenttypes in CAML format while developing sharepoint aplications. Some people spend days to complete these and some people spend hours depends on their knowledge on sharepoint, recently I have created webpart which will give sitecolumns and contenttypes in the form of CAML the main advantage of this is you will get complete features folderyou just need to deploy this into ur 12 hive...

Wednesday, February 24, 2010

Deploying Custom Resource files into "App_GloablResources"

Normally, when you create new webapplication in sharepoint the system will automatically copies all resources files from \\12\Config\Resources folder to respective webapplication Virtual directory "App_GlobalResources" folder this will work fine in normal scenarios, so in deployment you can just place your custom resources files into 12 hive Resources folder and create webapplication everything will work fineBut some times we may have to install...

Friday, January 8, 2010

Why people are not using sharepoint designer?

I have seen some people,they are not interested to use sharepoint desinger I dont know why? even though they are not familiar with syntaxs of sharepoint webcontrols , field contrls while desingning page layouts, customizing master pages and sharepoint controlsI dont know about other sharepoint developors, but whenever I get chance I love to use sharepoint desinger to customize my pagesBecause if we use sharepoint desinger our development will be faster, no need of sitting on Visual Studio and breaking head for syntaxs(not only for syntaxs it provides...