Subscribe to SharePoint Developement

Category: SharePoint Developement

Change the default scope of SharePoint calendar view to week

Actually using object model we can’t set the default scope of Calendar view. Let’s see how the SharePoint UI do it and then try to replicate the same in our solution. When you change default scope of calendar view through UI, SharePoint sends RPC request to _vti_bin/owssvr.dll.  To see what RPC request SP sends, let’s modify the default scope through sharepoint UI and check the […]

InvalidQueryExpressionException – the query expression is not supported

The best way to retrieve results from sharepoint list in terms of performance using client object model is to use ‘include’  with lambda expression. using (var context = newClientContext(http://server/site/sitecollection)) {  List currentList = context.Site.RootWeb.Lists.GetByTitle(“MyList”);  CamlQuery camlQuery = newCamlQuery(); camlQuery.ViewXml =“[YourViewXmlhere]”;  ListItemCollection collListItem = currentList.GetItems(camlQuery); context.Load(collListItem, items => items.Include(item => item[“ID”], item => item[“SomeField1”], item => item[“SomeField2”])); […]

SharePoint Feature Stapling

Feature stapling allows you to associate a set of  SharePoint features with any site definition. Therefore, whenever any site collection is provisioned from that site definition, the features associated with it gets activated automatically. Lets go ahead and see how to apply feature stapling. For this demo, I would staple these 2 OOB sharepoint features with Team Site (Site […]

Enable anonymous access to sharepoint 2010 site

Just follow these steps to enable anonymous access to your sharepoint 2010 site. Step 1 Open SharePoint Central Adminsitration. Under Application management tab, Click on Web Application management. Step 2 Choose your web application and click on ‘Authentication Providers’ link on the ribbon.   Step 3  Under ‘Zone’, Click on ‘Default’.  Step 4 Tick ‘Enable […]

Create a custom Web Template in Sharepoint 2010

Before we start creating a custom Web template, I think it’s important to understand do we really need to create one? Even though web templates are easy to create and maintain as compared to site definitions, I would not recommend web templates simply because of the fact that they gets stored in content database. Thus, there is always an […]

PrePopulate Sharepoint People Picker field with logged in user in list forms – Sharepoint 2007

There is this very common requirement to prepopulate sharepoint people picker field with logged in  user name in New and Edit forms of  sharepoint list. Below is something one can consider to achieve this – Using Sharepoint designer, add the following javascript code in Newform.aspx or EditForm.aspx to Pre-populate the logged in user as a default in sharepoint people picker […]

Send email to multiple users using Sharepoint Designer 2007

To send email to multiple users, stored in multi-user people picker field, using sharepoint designer 2007, one needs to play a little trick. Please do as follows: 1) Create a variable ,  create a new action of type Build Dynamic string:         Click on “Actions” and choose “Build Dynamic string”. Click on “Dynamic string”, this will open a new multiline textbox. Click on Add […]

The remote server returned an error: (502) Bad Gateway – While connecting to Sharepoint server

Recently, I got tangled with this “The remote server returned an error: (502) Bad gateway” problem when my custom webservice, which is using SP Client object model, failed to access sharepoint list. To troubleshoot this issue, I tried to login to the sharepoint site from the remote server using the same credentials under which my […]

Create and host a WCF service in SharePoint 2010

Recently, I came across a scenario where I had to hit sharepoint using client object model to query data from the entire site collection. Most of you must be aware that Client object model doesn’t provide an API that can query data from all the lists in a site collection. Therefore, I had to create a WCF service in Sharepoint which used […]