Friday, October 21, 2011

Groups available in different site collections


Is it possible that I create a group that is available to assign permission to, under different site collections ?

You may not be able to create a group avaialable in multiple site collections.

The nearest possible option is - you can set User Policy on a web application which would allow you to set the following permission types in all its site collections.

  •  Full Control - Has full control.
  •  Full Read - Has full read-only access.
  •  Deny Write - Has no write access.
  •  Deny All - Has no access.


You can select individual AD users / AD security groups as part of setting up web app user policy from Central Admin...

Sunday, October 16, 2011

Link a document to a document set


Do you want some other documents in your document set without uploading it???
  1. Edit your document set content type 
  2. Add a new content type "link to documents".

This would help you to add any number of document references in your Document Set by creating Document Links.

Saturday, October 15, 2011

SharePoint 2010 search : How it works???


SharePoint 2010 search architecture is made up of the following components

  • Crawler
  • Indexing Engine
  • Query Engine
  • Search User Interface 
  • Query Object Model

Architecturally every SharePoint 2010 Seacrh component is part of its query architecture and the crawling architecture. The query architecture includes query components, index partitions, and property databases. At the same time Crawl architecture includes components like Crawl component, Crawl database and Property database.


The server which has Web server role in your farm hosts Search Web Parts and Web Part pages for answering search queries. These web components interacts with the user in issuing search requests and accepting search response as results


The application server configured for having query components serves query results to web servers. It also holds part of / entire search index. It process the query issued by web server and forwards query requests to one query component for each index partition and then merges results to display to users. The query processor is also responsible for security trimming, duplicate results detection, and gathering and displaying properties.  Application server with crawl components Runs one or more crawler components. 


Database server Hosts search-related databases like Property DB, Crawl DB and Search Admin DB.


The crawl process works as given below

  1. When the Full crawl process starts, The Start address of the search source moved to queue. 
  2. The Protocol for earch determined and selects the requires Connector. 
  3. iFilter opens files and Content index created on crawl server. 
  4. Then the Index moved in batches to query server and the relevant Data written to Crawl and Property databases.



The query flow is follows

  1. When A search is performed by a user, the WFE serving the call uses the associated search service application proxy to connect to a server running the Query and Site Settings Service also known as the Query Processor.  It uses WCF for this communication. 
  2. The QP will connect to the following components to gather results merges\security trims and return results back to WFE: Query Component (holds entire index or partition of an index) Property Store DB (holds metadata\properties of indexed content) Search Admin DB (holds Security Descriptors\Configuration data). 
  3. Then WFE displays search results to the user

Monday, October 10, 2011

Client side code to check user permissions


You can check for a specific user permission in client side code using the following snipppet
BasePermissions bp = new BasePermissions();
bp.Set(PermissionKind.AddListItems);
ClientResult<bool> manageWeb = context.Web.DoesUserHavePermissions(bp); context.ExecuteQuery();
The above code snippet checks whetehr the user has AddListItems or not

Sunday, October 2, 2011

SharePoint pricing

Have you ever think about the cost factor of SharePoint implementation?


Basically there are three license / edition types available for SharePoint 2010 - Foundation, Standard, and Enterprise. Foundation is a free download, you can download it from Microsoft Site and perform basic SharePoint operations (doc management, collaboration etc) without paying anything for SharePoint License.


Standard and Enterprise editions require the purchase of SharePoint Server 2010 and licensing of the requisite feature set. Standard edition provides the features like web analytics, Content organizer, Document Sets etc along with the Foundation features


The Enterprise CAL is additive (i.e., you must already have the Standard CAL), and the Enterprise license will enable users to experience advanced features like Business Data Web Parts, Excel Services, Chart WebParts. It also provides the opportunity to add on a license for FAST Search Server 2010 for SharePoint. 


The detailed feature comparison can be found at http://www.sharepointedutech.com/2010/08/12/sharepoint-2010-version-comparison-table/


When it comes to pricing, the following are the common licensing/cost components 
  1. Windows 2008 Server Standard                - $1029 per Server
  2. Windows 2008 Server Client Access License   - $40 per user
  3. SharePoint 2010 Server Standard             - $4926 per server
  4. SharePoint Standard  Client Access License  - $95 per user
  5. SharePoint Enterprise Client Access License - $83 per user
  6. SQL Server 2008 Standard                    - $7200 per DB server

The above option will only allow you to setup intranet/extranet sites.
The following option is for internet facing setup where no client access license is requires.
  1. SharePoint Server 2010 for internet Sites Standard  - $11,793 per server
  2. SharePoint Server 2010 for internet Sites Standard  - $41,392 per server
For enhanced search options you can optionally choose
  1. FAST Search Server - $20,250  per server
Note: The prices may lack accuracy since it obtained from some other sites and blogs.


There is another option called Volume Licensing, which could offer you better rates. Check microsoft licensing site for details...

Saturday, October 1, 2011

OOTB Analytics feature


There is a web analytics service application coming up with SharePoint 2010. This would allow you to find out how users using your sites and pages.
For this you have to perform the following actions on a high level
  1. Create a new eb Analytics Service Application from Central Admin > Service Applications
  2. From Manage Services on Server, configure the Web Analytics Data Processing Service and Web Analytics Web Service.
  3. You can chk Web Analytics Service is running by click on Monitoring >"View Web Analytics Reports" under Reporting

You could see the web analytics repotts under Site Collection Settings

Once you set up web analytic service application configuration in youe environment, you would get the following reports if you logged in as a site collection admin.
  • Number of Page Views  
  • Number of Unique Visitors  
  • Number of Referrers 
  • Top Pages 
  • Top Visitors 
  • Top Referrers 
  • Top Destinations 
  • Top Browsers
This is a pure out of the box capability that requires few configuration steps


For details please chk
http://blogs.msdn.com/b/ecm/archive/2010/03/21/introducing-web-analytics-in-sharepoint-2010.aspx
 http://blogs.msdn.com/b/ecm/archive/2010/05/03/web-analytics-in-sharepoint-2010-insights-into-reports-and-metrics.aspx

Tuesday, September 27, 2011

Run With Elevated Privileges



Say you have implemented a webpart in one of your sharepoint sites. This web part will be used by all types of users from admins to readers. If some part of your web part code need to execute with Full Control rights even if the user does not have Full Control, SPSecurity.RunWithElevatedPrivileges Method can be used.


The following example sends an email using elevated privileges. This will elevate the privileges to execute using the service account. The SPSecurity.RunWithElevatedPrivileges method taks a delegate method as its argument and executes that code with the service account.


public void SendEmail(Email email)
{
   SPSecurity.RunWithElevatedPrivileges(delegate()
   {
        SmtpClient mail = new SmtpClient();    MailMessage message = new MailMessage();
            message.From = new MailAddress(this.SenderAddress);
            message.To.Add(email.To);
            message.IsBodyHtml = email.IsHtml;  
            message.CC.Add(email.Cc);  
            message.Bcc.Add(email.Bcc);  
            message.ReplyTo = new MailAddress(this.ReplyToAddress);  
            message.Subject = email.Subject;  
            message.Body = email.Body;


        mail.Host = this.CentralAdminOutboundServerAddress; mail.Send(message);
    });
}


This would allow the lower users too to use the email functionality without any issues even though it uses mail settings from central admin.



Delegate method or delegated block of code being excuted within RunWithElevatedPrivileges, will be executed with privileges of System Account i.e. the App Pool identity of the respective web application.
RunWithElevatedPrivileges should be used when code should execute SharePoint API on securable objects or processes for which current user doesn't have pemissions.
If it is required to access SPSite or SPWeb object for the current site, while executing block of code within RunWithElevatedPrivileges, new context for the SPSite and SPWeb should be created.
Common mistake developers make is use of SPSite or SPWeb objects retrieved from SPContext.Current in RunWithElevatedPrivileges block. This objects will have current user permission levels on the securable objects, not of the System Account.

Saturday, September 24, 2011

To remove button from Ribbon

Following are the steps to remove this button from Ribbon


In Visual Studio 2010:
  1. Create an empty SharePoint 2010 Solution , you may give your favorite name to it
  2. Add a feature by right clicking on the Features in Solution Explorer
  3. Right click on the Project and add a new item, choose empty element and name it
  4. Open the Elements.xml file from the newly added item
  5. Copy & paste the following XML into the Elements.xml file
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
     Id="RemoveRibbonButton"
     Location="CommandUI.Ribbon">
       <CommandUIExtension>
           <CommandUIDefinitions>
              <CommandUIDefinition
               Location="Ribbon.Library.Actions.OpenWithExplorer" />
           </CommandUIDefinitions>
       </CommandUIExtension>
    </CustomAction>
</Elements>

Deploy the Solution and observe that “Open with Explorer” button will be removed from the Ribbon.


Without Visual Studio: With SharePoint 2010 Management Shell (PowerShell)

  • Create a folder under %Program Files%\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\RemoveRibbonButton
  • Create a feature.xml file in RemoveRibbonButton.

<?xml version="1.0" encoding="utf-8" ?>

 <Feature Id="MyFeatureId"
 Title="Remove button feature"
 Description="Description of the Feature." 
 Version="1.0.0.0" 
 Scope="Web" 
 xmlns="http://schemas.microsoft.com/sharepoint/">
 <ElementManifests>
  <ElementManifest Location="manifest.xml" />   
  </ElementManifests>
 </Feature>


  • Create a blank xml file - manifest.xml in RemoveRibbonButton folder and add the below content to it and Save it.


<?xml version="1.0" encoding="utf-8"?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
     Id="RemoveRibbonButton"
     Location="CommandUI.Ribbon">
       <CommandUIExtension>
           <CommandUIDefinitions>
              <CommandUIDefinition
Location="Ribbon.Library.Actions.OpenWithExplorer" />
           </CommandUIDefinitions>
       </CommandUIExtension>
    </CustomAction>
</Elements>

  • Deploy the customization using SharePoint 2010 Management Shell (or Windows PowerShell): Install-SPFeature MyFeatureId Enable-SPFeature FeatureId -Url http://server/site/subsite (replace http://server/site/subsite on your site url)



Monday, September 19, 2011

FBA , Claims Auth in SP 2010


You may use the Forms Based Authentication for this. Here the credentials would be stored in an external SQL DB or similar data store.


Configure site in Claims Authentication Mode and configure membership and role provider details. This will give you default login page. You can customize it per your branding


You can create additional web parts to add user, remove, edit etc which would eventually write data to the SQL database used by FBA.


Following links would be helpful


http://blogs.msdn.com/b/kaevans/archive/2010/07/09/creating-a-custom-login-page-for-sharepoint-2010.aspx 


http://blogs.msdn.com/b/brporter/archive/2010/05/10/temp.aspx


http://www.topsharepoint.com/enable-anonymous-access-in-sharepoint-2010

Friday, September 16, 2011

To find the user name of a Manager of an user programatically




You can use spUser object to find the required user from Users collection of a site.
Instantiate a UserProfileManager object and assign the UserProfile by executing profileManager.GetUserProfile method.
The profile collection has a tag "Manager", retrieving that Value will give you the result.

Thursday, September 15, 2011

Tech jobs in SharePoint world

Quick note on Tech jobs in SharePoint world
SharePoint Architect : Who will architect and design Sharepoint farms and solutions for clients
SharePoint Developer : Who implements the sharepoint solution using out of the box features, configured features (using SharePoint Designer and SharePoint Web UI)  and develops .Net based code to accomplish certain features that are not available in SharePoint native feature set.
SharePoint Admin : Who administers the sharepoint environment and monitors the process, logs, health, content growth, backup etc etc 

Thursday, September 8, 2011

Quick and easy way to fix master page issue after creating site from a custom template


At times the sites created from customm site templates may not looks properly. This could be due to the master page not applied correctly.


Below the Quick and easy way to fix it 


To activate publishing features

  • First enable publishing infrastructure feature at site collection level
  • then activate SharePoint Server publishing feature at site level.

To apply master page

  • Open your source web app in sharepoint designer
  • select the master page from master pages gallery
  • Choose Export File option to save master page as file
  • Open your destination web app in sharepoint designer
  • Import the saved master page into its gallery
  • Set the newly imported master page as site master page

Tuesday, September 6, 2011

SharePoint Features


Per Microsoft, SharePoint feature is a modular server-side, file system-level customization (code based solution) that contains items that can be installed and activated in a SharePoint environment.


Say I need an additional functionality to be implemented on my sharepoint site, we use to create a feature for that and install and activate at the right level (farm, web app , site collection or site) to get to done properly.


Advantages of feature are


Features would help add / remove the functional components together as a single entity which would help the management easier
Feature would allow owners / admis of a site to turn on / off the features as per the reuirement


Technically Features is a collection of one or more feature.xml file that is located in a custom subdirectory of the features directory. Features can also contain other files that make up its components, such as and most commonly an XML file that contains a list of Feature elements. 

Saturday, September 3, 2011

Workflow Basics


SP Workflow is an option to manage business process generally oriented around SharePoint list data model. User can start SharePoint workflow manually but they usually start automatically in response to some event connected with a list item or library item such as adding, deleting or updating an item. 

There are workflows associated with subsites rather than lists or content types - these cannot be started in response to an event ; it  has to happen manually or programatically. Such workflows will be helpful in setting and retrieving multiple list items across lists or performing non list operations like creating and configuring subsites.

The Reusable and Globally Reusable workflows in SPD is another kind of list workflow that can be used on multiple lists without having to recreate them for for each list.

SharePoint workflows are built on top of WF. when a workflow is running in SharePoint WF engine is hosted in SP Process; it loads and unloads WF templates and provides sequencing and persistence for workflows. WF enables customization in transaction, persistence, notifications, roles, tracking and messaging of SharePoint workflows.   
Every SharePoint Workflow is represented by the following Two entities that work together

  1. Workflow Definition that specifies the paremeters, events (like activation), sequence of activities , branching structure, conditions that determine the paths of execution. WF Definition can be defined in code and compiled into an assembly. The other option is to define it in  an XOML markup (declarative / nocode workflow) where it persist uncompiled in content DB until its called
  2. Workflow Template Definition which is an XML file that contains the info require to instantiate and run workflow like name of WF, Description, class with WF assembly to call, Identity of WF assembly, Location of any custom forms. These XML files can be stored at 14\TEMPLATE\1033\Workflow or Workflows list of root site in a site collection. In rutime, WF template defintion is used to create a cached SPWorkflowTemplate object.

The extensibilty options in WF are

  1. Custom compiled workflows using VS Workflow designer
  2. Custom Declarative WF using SPD

Usually Workflows installed as Site Collection Level Features but we can also publish WF directly from SPD which doesnt require any feature. Every WF association will have an entry in Site Collection Content DB.