Posts

Showing posts from 2012

Getting Page Field Value in custom publishing page layout

I wanted to create a custom publishing page layout which should render certain UI elements based on the page metadata. For e.g. a page metadata field called "Page Type" being used to display different links on pages (created with the page layout). Surprisingly, first step in the process i.e. reading the page field using SharePoint Javascript API proved to be rather painful as my good friend google wasn't willing to put it on my plate. Finally came up with some code to get this done so sharing below:---- Include this code into your custom publishing page layout to query page metadata fields within the layout: /**************************************************************************************/ var pageItem; //variable for list item of page being displayed (which uses this page layout) var pageFieldNameVar = '[internal name of a custom page field]' ; //variable for page field to be retrieved var context; // This variable will cont...

Read Web.Config settings while using Delay Activity in SharePoint Visual Studio Workflow

Be careful if you ever have to read a web.config setting from a SharePoint visual studio workflow when you are also using Delay activities. When a workflow wakes up from a Delay activity, it’s no longer running in an ASP.Net Worker Process. Instead it’s running in the process for SharePoint Workflow Timer service.  So, the method to read the setting would be different in that case. Your method to read the web.config app settings should be somethink like below: private string GetWebConfigSetting(string settingKey) {     string webconfigSettingValue = String.Empty;       if (ConfigurationManager.AppSettings[settingKey] != null) //reading app setting from web configuration file       {        webconfigSettingValue = ConfigurationManager.AppSettings[settingKey];       }             ...

SharePoint Permission Inheritance – Site versus Library

I learnt this, the hard way recently that SharePoint security inheritance mechanism between "Site and Library" is not the same as "Site and Sub sites". Let's say you have parent site "Parent Site" and its sub site called "Child Site". You break inheritance on "Child Site". Any security changes you make to parent "Parent Site" now, should not affect "Child Site" as it has unique permissions. All good between sites. SADLY it is not the case between Site and document libraries. Let's say you have a site called "ABC Site" which has a document library called "Doc Lib". You assign direct "Contribute" permission to a user "User1" on site level. You break inheritance on "Doc Lib". Now "Doc Lib" has a copy of all permissions (including "User1") from the site and you can add/remove more permission. Now ideally, any security ...

SharePoint 2010 Records Management. Things you should know...

Planning to implement SharePoint 2010 Records Management. Read on... · File Plan: There should a clear and well defined Organizational File Plan, before the implementation begins. · Permissions not routed: When documents are routed to records centre or any other site, permissions are not carried across (which might not suit all client’s). · Only latest version routed: When a document is routed to a records centre or any other site, it is the latest version of the document that is routed (not all stored versions). · Content Database Sizing: Beyond SP1, for a SharePoint content database over 4TB specifically for a Document Archive scenario you are required to additionally plan for the following (according to msdn): o SharePoint sites must be based on Document Center or Records Center site templates and must be an archive scenario where less than 5% of content is actively read from each month and less tha...

Automatic SPD Workflows do not run on Drop Off Libraries

Background: SharePoint 2010 has a Content Organizer feature by means of which we can automatically route documents from one site to another. That same feature is used to automatically route documents from collaboration sites to Records Centre as well. Content Organizer has a concept called “Drop Off Library” for each site. Documents being routed first hit this library from where it can either be automatically or manually routed to appropriate document library within a site. Problem: Automatic SharePoint Designer workflows don’t run on Drop Off libraries. So, If you plan to use Content Organizers to automatically route documents from one site to another AND you also need to trigger a workflow when a document hits Drop Off library then the only choice would be Visual Studio Workflow rather than SharePoint Designer Workflows.

Using Activity Feed Web Part outside My Sites

Image
One of the project i have done had a requirement that Activity Feed web part should be displayed on intranet home page. This is the one that is displayed by default on "My Newsfeed" page of SharePoint 2010 my sites. Well bad luck. The web part is not available by default to any other sites except my sites. One of my c olleagues had  an idea of exporting this web part from my sites and importing it into intranet site. So far, so good. Web part successfully displayed and showing Newsfeed. Since, this web part was being displayed on the intranet home page in a much shorter area than a "my site" home page, something had to be done to remove the extra information. I override some css to make the web part fit a small area on home page. Following are the overridden css classes just in case somebody needs them: Used to hide the top links ("My Colleagues", "My Interests" and "Newsfeed Settings") in Activity Feed web part: .ms...

Missing Activity Feeds in Activity Feeds Web Part

Image
Everybody has seen the out of the box Activity Feeds web part displayed on default page of SharePoint 2010 my sites. Don't be surprised if the number of activity updates being displayed are less than the number you set through "Number of items to show" property. I had this problem in a project and Microsoft was contacted. Well, according to them, this is by design. Following is Microsoft's response in their own words: Disclaimer: Following content is being published as is with no guarantees regarding the accuracy. *************************Microsoft's Response************************************** Root cause: ================ 5 activity types(as listed below) will go through security trim. For these types of activities, as long as it contains an external URL link(the url other than mysite root and mysite’s layouts pages, the activity will be trimmed. BlogUpdate SharingInterest SocialTaggingByColleague Not...

Best Practice Feature Stapling

Whoever have tried using feature stapling for customizing the out of the box function​ality of a site upon creation (e.g. My Site customization) would note that there is no easy way to customize the existing functionality through feature receiver on Staplee. For e.g. you can easily add new components such as lists and libraries, activate additional features through feature receiver but it is usually a nightmare to modify existing functionality such as changing settings of out of the box lists being created as part of site provisioning or automatically applying a custom master page on newly created site. This problem stems from the fact that the features are activated on a newly created site even before the site itself has actually finished provisioning. Since, your feature staplee would be just like other features being activated on a newly created site, the feature receiver code would execute even before the site has been fully created. So, let's suppose if you t...