Posted on November 23rd, 2015 by Kaushik Mohanty
If you are using Visual Basic (VB 6) and need to open new tabs in Internet Explorer (IE 7) from code, here is some sample code that will do the trick. Private Declare Sub VariantChangeType Lib “oleaut32” _ (Destination, Source, ByVal wFlags As Long, ByVal vt As VbVarType) Private Sub Document_New() Dim ie As […]
Posted on November 23rd, 2015 by Kaushik Mohant
In Microsoft Sharepoint, the SPQuery class is used to build query strings to filter / retrieve specific set of data programmatically from a SP List. The query strings created this way does not resemble a SQL syntax as much as it resembles a XSLT query object, where everything gets formatted as XML strings. For instance, […]
Posted on November 23rd, 2015 by Kaushik Mohanty
STSADM tool is used for command-line administration of Office SharePoint Server 2007. Stsadm is usually located at “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN” and the user must have Administrative rights to use this tool. This tool provides access to the complete set of operations on the SharePoint Server 2007. STSADM proves to be a boon […]
Posted on November 23rd, 2015 by Kaushik Mohanty
In the first part of my tips series on the STSADM commands covered the basics of the tool and its usage for the general SharePoint Migration tasks. However, on SharePoint server 2007 , STSADM provides a lot more operations than just migration tasks. This installment covers the commands used to achieve different operations with SharePoint […]
Posted on November 23rd, 2015 by Kaushik Mohanty
Most often we are accustomed with the out-of-the-box functionalities in SharePoint to start a workflow attached with a list / library.There might be a requirement where the workflow needs to be started manually from within a programming interface i.e. a custom form which can be used for triggering workflow on specific list / library items. […]
Posted on November 23rd, 2015 by Kaushik Mohanty
In Sharepoint, columns like Choice Field are often used to hold multiple choice options which are then displayed as values of DropdownList / RadioButtonList / CheckboxList. While developing Custom Webparts for add/edit form (related to any List having the Choice Fields) in VS 2005, there is always a need to fetch these choice options and […]
Posted on November 23rd, 2015 by Samarendra Swain
Generally web applications in SharePoint are created using the out-of-box functionality provided within Central Administration. But because of some client’s needs there might be a requirement of creating these web applications within a custom utility solution. This functionality can be achieved programmatically using Microsoft SharePoint APIs. By this, one can easily create a web application […]
Posted on November 23rd, 2015 by Kaushik Mohanty
First of all we need to know a little on SharePoint lookup fields before proceeding further. Lookup fields are the reference fields created in any SharePoint list or library which provides a mapping between columns from another list i.e. it is just like a foreign key which helps build relationship between lists. While developing custom […]
Posted on November 23rd, 2015 by Samarendra Swain
In SharePoint, custom views are used to display the items in a list/libraries with custom look and feel.Therefore you have to choose a view format like Standard View, Calendar View, Datasheet View or Gantt View and accordingly you can customize the display style by choosing Filter condition, Sort method, Group By condition etc. SharePoint allows […]
Posted on November 23rd, 2015 by Kaushik Mohanty
Most of the times we have requirements of adding different client side validations on the web pages and the easiest way to achieve this in ASP.Net is to use the existing set of validator controls. In SharePoint when we design custom webparts which takes some data as input, we might need to add some client […]
Posted on November 23rd, 2015 by Samarendra Swain
SharePoint site security helps manage permissions for different resources within a site by defining the levels of accessibility permissions for different peoples and groups. In SharePoint, always the top-level or the parent level permissions are inherited to it’s child contents (e.g. a sub-site inheriting permissions from it’s parent site collection). In-order to create unique permission […]
Posted on November 23rd, 2015 by Samarendra Swain
In SharePoint, integrating publishing feature is possible only in MOSS 2007 site and not in WSS site.By turning on publishing feature you can use Web Content Management(WCM) feature in the site.Once the WCM feature is enabled you can then brand the site with your custom look and feel and can also enable the multilingual support […]
Posted on November 23rd, 2015 by Kaushik Mohanty
In SharePoint, one can use PageViewer WebPart within a webpart page to display another web page within it. All that one is required to do is, provide the URL of the page as the ContentLinkparameter of the WebPart. However, users might often have requirements of resetting the ContentLink parameter at runtime i.e. they may need […]
Posted on November 23rd, 2015 by Saroj Dash
List Templates List templates are predefined layouts available in SharePoint which can be used to create new content quickly and easily .The List templates are maintained within the site collection List template gallery. Sharepoint provides OOTB functionality to create and delete list templates. Below mentioned are ways to Save a list as List Template and […]
Posted on November 23rd, 2015 by Samarendra Swain
A common requirement that every Sharepoint developer is asked for today is customization of the SharePoint site based on various customer specific requirements. Most often customers have requirements where they want to add some additional features to action menus like Site action menu, ECB menu or List/library Action menu, etc. To achieve this, we have […]
Posted on November 23rd, 2015 by Kaushik Mohanty
The tip below describes the programmatic approach for enabling and disabling Search Visibility of a website in Office Sharepoint Server.The code sample is provide in C#.Net and the keyword “web” refers to the SPWeb object retrieved from a site collection. /* — Enable Search — */ web.AllowAutomaticASPXPageIndexing = true; web.ASPXPageIndexMode = WebASPXPageIndexMode.Always; web.NoCrawl = false; […]
Posted on November 23rd, 2015 by Kaushik Mohanty
We can use SharePoint API as well as SharePoint List web reference to update List Items. Using API it is quite straight forward as we can directly assign a DateTime object against a DateTime field in SharePoint list. But with List web reference it is not that straight forward as we need to first convert […]
Posted on November 23rd, 2015 by Samarendra Swain
In SharePoint document Library/List we find menu items like New, Uploads, Actions and Settings etc. At times there might be requirements to rename these menu items for a specific site. The following Javascript function can be used to achieve the objective. The code snippet shown below can be called from inside the specific SharePoint Page. […]
Posted on November 23rd, 2015 by Kaushik Mohanty
Often there is a requirement of creating Lists within a SharePoint website programmatically using API calls. Described below are 2 different methods of achieving the same using C#.Net as the programming language. In the first approach, a SharePoint List gets created using an existing custom List Template present within the List Template Gallery. This approach […]
Posted on November 23rd, 2015 by Kaushik Mohanty
You can think of a SharePoint List somewhat similar to a table present within a Database. As tables consist of different columns, a SharePoint List also comprises of different columns / fields and these fields can indeed have different attributes associated to it (like “Required field check”, “Max Length”, “Display Formats”, etc). We can use […]
Posted on November 23rd, 2015 by Saroj Dash
A list item in SharePoint can have multiple attachments. Below is a code snippet in c#.Net to add an attachment to a list item programmatically. This example demonstrates how a file, uploaded through a file upload control is added as an attachment to a list item. using (SPSite oSPsite = new SPSite(http: //website Url/)) { […]
Posted on November 23rd, 2015 by Samarendra Swain
As we can have multiple attachments against a list item, it has always been a requirement to fetch these attachments and get it displayed within a custom webpage. Below is code snippet in c#.net for fetching all the attachements for a specific list item. try { // Set the Site Url SPSite objSite = new […]
Posted on November 23rd, 2015 by Kaushik Mohanty
In SharePoint, View is a virtual representation of a set of data from a specific list. We can programmatically create and update views for a list. Provided below is an example in C#.Net which explains the approach of creating and updating views. The code is divided in to 2 parts i.e. Part I – describes […]
Posted on November 23rd, 2015 by Kaushik Mohanty
Folders help group related items within a list. The code snippet provided below (in C#.Net) explains the approach of creating a folder within a specific list. using (SPSite oSPsite = new SPSite(“http://website_url”)) { oSPsite.AllowUnsafeUpdates = true; using (SPWeb oSPWeb = oSPsite.OpenWeb()) { oSPWeb.AllowUnsafeUpdates = true; /* Path within the list where the new folder gets […]
Posted on November 23rd, 2015 by Samarendra Swain
As we will see in SharePoint 2003, it was not possible to add a simple piece of server side code in the content pages. But in SharePoint 2007 adding server side code to the content pages is possible. This can be achieved by modifying the web.config file. In the web.config file you can find <PageParserPaths> […]
Posted on November 23rd, 2015 by Saroj Dash
Using Microsoft Sharepoint APIs we can easily Add, Update and Delete list items programmatically. Provided below is a code snippet in C# .Net demonstrating all the three operations.. using (SPSite oSPsite = new SPSite(“http://website url/”)) { using (SPWeb oSPWeb = oSPsite.OpenWeb()) { oSPWeb.AllowUnsafeUpdates = true; // Fetch the List SPList list = oSPWeb.Lists[“MyList”]; //Add a […]
Posted on November 23rd, 2015 by Kaushik Mohanty
Choice fields are often used within SharePoint lists to display choice options like Gender, Status, etc and these choice options can be displayed using Radio Button and Dropdown formats. Provided below is a code sample in C#.Net which describes the creation of a choice field programmatically using SharePoint API. /* get the newly added choice […]
Posted on November 23rd, 2015 by Premananda Das
In some cases we need to add documents to the doument library programatically, the code snippet below demonstrates how to add a document to the document library . using (SPSite objSite = new SPSite(“urlAddress”)) { objSite.AllowUnsafeUpdates = true; using (SPWeb oSPWeb = objSite.OpenWeb()) { oSPWeb.AllowUnsafeUpdates = true; //Test1 is the document library SPList docLibrary = […]
Posted on November 23rd, 2015 by Premananda Das
Some cases we need to associate the workflow to a list programatically.The below example show how we can attach a workflow to a list programatically.The workflow can be standard or designed with visual studio or sharepoint designer. SPWorkflowTemplate workflowTemplate = null; // Workflow template SPWorkflowAssociation workflowAssociation = null; //Workflow association SPList historyList = null; // […]
Posted on November 23rd, 2015 by Premananda Das
In certain situation we need to pass data from webpart to another webpart present in the same site. To implement the connection functionality between WebParts, we should create an Interface .This interface will be implemented by both the provider and consumer classes. Then we will use the ConnectionProvider and ConnectionConsumer attribute to make the connection […]
Posted on November 23rd, 2015 by Kaushik Mohanty
The first part of my tips series on SPQuery class covered the basics of building a CAML query string to filter data from a SPList programmatically. However, a lot more complex data retrieval operation can be achieved using the SPQuery. Over here we will try to build more complex CAML queries with multiple And/Or conditions […]
Posted on November 23rd, 2015 by Premananda Das
In SharePoint document library there is an option in action menu i.e “open in Windows Explorer”,When we click this one we can see all the documents in a window explorer,where we can drag and drop the documents for the document library . But in case of a SharePoint generic list we don’t have this option.To […]
Posted on November 23rd, 2015 by Saroj Dash
SharePoint provides options to create sites with different types of locales available out of the box. Suppose we have a SharePoint site built using the English locale and we want to change the existing site to some other locale then this can be achieved using the following piece of code. Changing the locale of the […]
Posted on November 23rd, 2015 by Premananda Das
When we want to add a custom button to a list toolbar we can add it by using a feature.But when we are activating the feature it will be apply to the scope secified, so all the lists present inside the scope will have a button added to it’s toolbar. But if we want to […]
Posted on November 23rd, 2015 by Saroj Dash
At some point of time there might be a requirement to access a SharePoint site programmatically and list the names of all the groups a user is associated to without using SharePoint APIs. Here is a small piece of code in C# which demonstrates how to achieve the above action using web service(s) available for […]
Posted on November 23rd, 2015 by Premananda Das
For each item in a SharePoint list,an ID is associated with it.This ID is automatically generated when we add a List item. It is easy to get the item id after the item is added(either programtically or by viewing the ID column of the list).But how to get the ID of the item before the […]
Posted on November 23rd, 2015 by Kaushik Mohanty
Using SharePoint object model we can pull out all the cross-site groups either by using SPWeb.Groups or by using SPWeb.SiteGroups. Then what is the difference between the two? SPWeb.Groups will allow you to pull out only the groups which have some / any kind of permissions defined within the site. SPWeb.SiteGroups will pull out all […]
Posted on November 23rd, 2015 by Kaushik Mohanty
What is the general approach we follow when we try to add / edit a SPListItem using the SharePoint object model? Yes I know it! Almost everybody will have a common answer to this (which is something similar to what is provided below). SPListItem item = SPList.Items.Add(); item[“Column1”] = “value for column 1”; item[“Column2”] = […]
Posted on November 23rd, 2015 by Premananda Das
When we want to run a task (like sending emails or deleting the list items etc. . . ) in Daily basis or in Hourly basis then we can use a Timer job to this task .To see the timer job you can move to the Central Administrations then click on the operations tab, then […]
Posted on November 23rd, 2015 by Rasmita Mohanty
We can programmatically hide or remove the Quick Launch items from within a SharePoint Site to give that site a customized look and feel. We can easily hide / show the Quick Launch items using the QuickLaunchEnabled property of a SPWeb object.. /*1st code block*/ SPSite spSite = new SPSite(SiteUrl); SPWeb spWeb = spSite.OpenWeb(); spWeb.QuickLaunchEnabled […]
Posted on November 23rd, 2015 by Rasmita Mohanty
In SharePoint we can use the AlertMe option present within a List or a Document Library to create one or more alerts for sending notifications to a set of users based on different events. SharePoint provides out of the box options for creating and managing alerts. We can also create these Alerts programmatically using the […]
Posted on November 23rd, 2015 by Premananda Das
The PeopleEditor control is a wonderful control to help you easily select one or more users from the users known in the directory service of the server. The PeopleEditor control performs queries against the Active Directory.To select more then one user we need to set the property MultiSelect to true. Here is the code snippet […]
Posted on November 23rd, 2015 by Saroj Dash
While executing custom code in SharePoint, one might run into instances where a user suddenly gets “Access Denied” error message i.e. the user gets redirected to the “_layouts/AccessDenied.aspx” page. These kind of situations usually occur when a user tries to perform a particular task which he/she does not have permission to do. These user permission […]
Posted on November 23rd, 2015 by Premananda Das
In SharePoint, if we want to perform a search within a predefined scope then we can go for two out-of-the box web parts. One is the search box web part and the other one is search core results web part. The search box web part contains a dropdown and a textbox .The dropdown contains the […]
Posted on November 23rd, 2015 by Srikanta Barik
Some important Basic Powershell script commands which are used in our day to day life for deployment process on Sharepoint 2010 Adding SPSolution Add-SPSolution -LiteralPath “solution path\solutionname.wsp” Install SPSolution Install-SPSolution -Identity “solutionname.wsp” –GACDeployment. Upgrade the Existing Solution Update-SPSolution -Identity “solutionname.wsp” -LiteralPath “solutionpath\solutionname.wsp” -GACDeployment UnInstall the SPSolution Uninstall-SPSolution -Identity “solutioname.wsp” Remove the […]
Posted on November 23rd, 2015 by Srikanta Barik
If you are using Visual Studio 2010 for developing the Sharepoint 2010 solutions,especially the tools(console or windows) for backend operation.Then you may have noticed that Visual Studio will not recognise the references of the Sharepoint dll even though you have added the reference to the VS 2010 and it will through the exception as “The […]
Posted on November 23rd, 2015 by Srikanta Barik
Timer jobs are tasks scheduledto perform specific maintenance tasks in a specified regular time interval.It contains a definition of the service to run and specifies how frequently the service should be started. The Windows SharePoint Services Timer service (SPTimer) runs timer jobs. Many features in SharePoint Products and Technologies rely on timer jobs to run […]
Posted on November 23rd, 2015 by Srikanta Barik
Sharepoint 2010 has so many new exciting features and one of them is InPlace Record Management. By using this feature one can Declare Item as Record or Lock the record so that it will obey a set of policy based on Policy declaration. If the policy declaration is that it should not allow anybody to […]
Posted on November 23rd, 2015 by Srikanta Barik
Sharepoint Designer 2010 makes life easy for many developers and helps them develop complex workflows without writing a single line of code. But there are many settings presents on SPD2010 Designer which we have to learn. Here I am going to mention the steps on how to assign a task and send task notification email […]
Posted on November 23rd, 2015 by Arindam Deb
If we want to alert user when a new item is created or uploaded in a particular list or document library, we can do this by using workflow. First, we have to create a new project in Visual Studio 2008 by click on File–>New–>Project. Then, select Visual C#–>Office–>2007–>SharePoint 2007 Sequential Workflow. Now, give a name […]
Posted on November 23rd, 2015 by Premananda Das
There are numbers of out of the box web services present in SharePoint that will do most of the common tasks like methods for working with list ,sites and sub sites, users and groups etc. For using these web services you need to add the reference of the web service . But if your requirement […]
Posted on November 23rd, 2015 by Kumari Sony
SharePoint helps us create multiple zones for a single website e.g. Intranet (accessed only within an organization), Extranet (accessed within an organization + few limited users over web), Internet (mainly for public users), etc. Every SharePoint website has its default start page set as default.aspx. Even if we have separate zones for a website but […]
Posted on November 23rd, 2015 by Premananda Das
In SharePoint we can create a web application and extend the same web application for different zones, the content will be remain same but the url will be different for each zone. Let’s say I am having a web application on port 2020 and the url is http://test:2020/ . Now I want to use this […]
Posted on November 23rd, 2015 by Arindam Deb
Sometimes we get the error “The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again”, when we upload a document into a document library.. We can solve this by going to Central Administration–> Application Management–> Web Application General Settings and set the Web […]
Posted on November 23rd, 2015 by Jayprakash Mourya
Some times in sharepoint 2010 we need to have to view/delete the users from site collection, moreover in sp2010 we don’t have any link as “All People” as it is present in MOSS2007. So it is a tedious process to view/delete the users from site collection. For this purpose what we can do in sp2010 […]
Posted on November 23rd, 2015 by Kaushik Mohanty
Sometimes we might need to programmatically retrieve the physical / local path of a web application and to achieve this we can use the code snippet provided below.. using (SPSite oSite = new SPSite(“your site url”)) { string physicalPath = oSite.WebApplication.IisSettings[SPUrlZone.Default].Path.ToString(); } Over here we have taken an instance of our site and then trying […]
Posted on November 23rd, 2015 by Jayprakash Mourya
In MOSS2007 we can get to the STSADM by opening windows command prompt and changing directory to: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN In SharePoint 2010 we can find this at location: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN Now to get the size of your site type the following command on the prompt: STSADM.exe -o […]
Posted on November 23rd, 2015 by Tarunkumar Singh
Sometimes security may be one of the major issues while writing codes. A user who has only read permission can’t add a new list item, can’t edit a list item, can’t delete a list item – In this case if we try to perform any of these operation, it will throw an exception. There may […]
Posted on November 23rd, 2015 by Niraj Ishwar
JavaScript function CustomActions() { function Button_Callback(dialogResult, returnValue) { if (returnValue == ‘0’) { //do something } else if (returnValue == ‘1’) { //do something } else if (returnValue == ‘2’) { //do something } else{ //do something } } var options = { url: ‘Page Url’, title: ‘Custom Actions’, allowMaximize: false, showClose: true, width: 610, […]
Posted on November 23rd, 2015 by Niraj Ishwar
This tip demonstrates- How to Populate SharePoint PeopleEditor Control . How to get selected user from SharePoint PeopleEditor Control . In .aspx file <SharePoint:PeopleEditor ID=”user” runat=”server” SelectionSet=”User” AllowEmpty=”false” Enabled=”false” MultiSelect=”false” ValidatorEnabled=”false” /> *Here MultiSelect property is set to false which allow only single user selection. In .cs file Method for populating SharePoint:PeopleEditor control with logged […]
Posted on November 23rd, 2015 by Pushpendra
This piece of code will let you create SharePoint 2010 web application programmatically enabling FBA. SPWebApplicationBuilder webAppBuilder = new SPWebApplicationBuilder(SPFarm.Local); webAppBuilder.Port = portNo; webAppBuilder.ApplicationPoolId = “IIS application ID”; webAppBuilder.IdentityType = IdentityType.SpecificUser; webAppBuilder.ManagedAccount = mngAcc; webAppBuilder.RootDirectory = new DirectoryInfo(“physical path of web application”)); webAppBuilder.ServerComment = “Server comment”; webAppBuilder.UseNTLMExclusively = true; webAppBuilder.AllowAnonymousAccess = false; webAppBuilder.CreateNewDatabase = true; […]
Posted on November 23rd, 2015 by Niraj Ishwar
This tip demonstrates how to find different kinds of hierarchy existing within user profiles. For example You can find immediate manager of a particular user. All the users who reports the same manager. All the managers above in the chain for a particular user Find Manager for currently logged in user. private void GetManegerProfile() { […]
Posted on November 23rd, 2015 by Aniket Banerjee
First of all, you need to add a reference manually to sysglobl.dll. sysglobl.dll is a very tiny assembly. It contains only one class CultureAndRegionInfoBuilder Include the namespace System.Globalization. Add the following code snippet written in C# for achieving it….. string UserSystemLocale = System.Globalization.CultureInfo.InstalledUICulture.ToString(); string CurrentSiteLocale = web.Locale.ToString(); using (SPSite site = new SPSite(“site url”)) { […]
Posted on November 23rd, 2015 by Himansu Samal
Many times we have a need of creating a Lookupfield at the time of List creation. Many ways and many tips are there to create a Lookup field programmatically, but I am not focusing on how to create a lookupfield rather how to add an additional field option to an existing Lookup field / Item. […]
Posted on November 23rd, 2015 by Kaushik Mohanty
1. Prerequisite: SharePoint 2010 Enterprise and Visio 2010 2. In order to turn on Visio Service, go to “Manage Site Features” within Site Settings. 3. Activate “SharePoint Server Enterprise Site Features” if not already activated. 4. Now go to the Document Library which will host the Visio files to be available over browser. 5. Open […]
Posted on November 23rd, 2015 by Indrakshi Ghosh
Are you facing trouble with search feature in Sharepoint environment ? I think, the following steps can help you out. First of all you need to make sure that your search service application is created. If not, then you need to create it first and then follow the below. 1: Go to Central Administrator -> […]