Posts

Get list of sites from SharePoint content database

 This command will get the list of sites from the content Database. $db = Get-SPContentdatabase "sql_test_db_name"  $db.sites

Delete Document Library using SharePoint Power Shell Script

$SiteUrl = "http://SP:2010/sites/TestSite" $web = Get-SPWeb $SiteUrl   $library = $web.lists["Shared Documents"] $library.AllowDeletion = $True $library.update() $library.Delete()

programmatically impersonate users in SharePoint

private static void impersonateTest () {    string siteStr = "http://mysharepointsite/" ;    SPSite tempSite = new SPSite ( siteStr );    SPUserToken systoken = tempSite . SystemAccount . UserToken ;    using ( SPSite site = new SPSite ( siteStr, systoken ))    {        using ( SPWeb web = site . OpenWeb ())        {            //right now, logged in as Site System Account            Console . WriteLine ( "Currently logged in as: " +                               web . CurrentUser . ToString ());            switchUser ( web, siteStr, "BlackNinjaSo...

Delete multiple site collections using SharePoint Power Shell Script

This script will delete site collections from the SharePoint server completely. But we need to provide the site collection names to the Power Shell Script as a ";" separated values. Power Shell Script: Ex: $SiteCollection =  "http://SP-S2010/sites/TeamSite1;http://SP-S2010/sites/TeamSite2"  $SiteCollection = "http://SP-S2010/sites/TeamSite1;http://SP-S2010/sites/TeamSite2"  $SiteArray = $SiteCollection.Split(";") foreach($Site in $SiteArray)  {       Remove-SPSite –Identity $Site –GradualDelete –Confirm:$False }

Client object model Architecture

Understanding the Client Object Model Understanding how the Client Object Model works will help you be more effective across all three versions. As shown in Figure 13-1, the Client Object Model fundamentally is a new Windows Communication Foundation (WCF) SharePoint service called Client.svc and three proxies: .NET CLR, Silverlight, and JavaScript. You program against the client proxies just as you do with any service. Calls to and from the server are sent in batches to increase network efficiency. Figure 1. Client Object Model Architecture Client Object Model architecture

Feature stapling and site provisioning challenges

Feature stapling is an interesting concept in the SharePoint world, that allows you to associate a feature with any site definition. This feature will be activated automatically when a new site is created  from the associated site definition. Feature stapling consists of two elements : --“Stapler” – the feature that specifies what features to be associated with site definitions <Elements xmlns=" http://schemas.microsoft.com/sharepoint/ "> <FeatureSiteTemplateAssociation Id="{Guid of the staplee feature}" TemplateName="SPSPERS#2" /> <FeatureSiteTemplateAssociation Id="{Guid of the another staplee feature}" TemplateName="SPSPERS#2" /> </Elements>  This example associates two features with the personal site definition in SharePoint 2013 ( in SharePoint 2010 the TemplateName would be SPSPERS#0 ) --“Staplee” – the feature associated with a site definition or the feature that applies the customi...

Managed Metadata Configuration and Association

Image
Introduction Managed Metadata is a hierarchical collection of terms that can be associated with items in SharePoint 2010. We can use Central Administration website to manage these terms. This is a new feature in SharePoint 2010. Example : You have a document library to upload articles.  For each item you can specify a column metadata of category like C#, ASP.NET etc. The Purpose So you might be wondering that there exist list columns for the same purpose.  Following are some advantages provided by Managed Metadata: Term Sets can be shared across a site collection or globally Searching using Metadata gives more relevant result Some Concepts inside Managed Metadata Term : A term is keyword that can be associated with a SharePoint item. Term Set : A term set is a group of terms.  You can restrict that a particular item should contain a term from a particular term set.  For example: setting the category of an article item from term set [C#, ASP.N...