Through this blog, it is my effort to share experiences with the community and make the journey enjoyable.

Tuesday, November 14, 2017

Multi-factor Authentication (MFA) with CSOM

OfficeDevPnP.Core.AuthenticationManager is part of the PnP Core Library available here:

var authManager = new AuthenticationManager();
var ctx = authManager.GetWebLoginClientContext("");
Web web = ctx.Web;
User user = web.CurrentUser;

Saturday, February 18, 2017

Wednesday, February 15, 2017

SharePoint Framework (SPFx) Resources


SharePoint Framework - App File (.sppkg) Upload not working

Issue - On upload of app (.sppkg) file, App package not getting valid. On uploading, it is expected to SharePoint will display a dialog and ask you to trust the client-side solution to deploy.
However, popup is not coming. Also, Product ID is also blank

Reason - Your Tenant is not a Developer Tenant. SharePoint Framework is not available in production environment, so the only way you have to test it, is using a dev tenant. 

Resolution -

  1. Follow the steps to create a new Office 365 Developer Tenant -

  1. Convert existing tenant to Developer Tenant -  Make sure you have First Release options enabled.

After updating First Release settings, it may take a while to update the settings. Once updated, your tenancy would have SharePoint Framework Release enabled and App Packages will function as required.

SharePoint Framework Tutorials - YouTube Playlist


SharePoint Framework Yeoman template broken by TypeScript 2.1 definition

Building SharePoint Framework new project using gulp serve, gives errors for TypeScript building the project.

Issue - SPFx broken by Typescript 2.1 extensions
Resolution - npm install @types/lodash@4.14.50

SharePoint Framework - Starting a new project

  1. Setup your development environment based on the steps defined at

  1. At command prompt use following command - 

yo @microsoft/sharepoint

  1. Install the developer certificate for use with SPFx development, switch to your console, make sure you are still in your project directory and enter the following command:

gulp trust-dev-cert

  1. Enter the following command in the console to build and preview your web part:

gulp serve

Saturday, February 11, 2017

Ionic 2 - Visual Code - Extensions

When beginning development with Ionic in Visual Code, following extensions would save lot of effort and time -


Ionic2 - New Project - Error - no such file or directory, open '..\index.html'

After creating a new ionic 2 project, serving project for first time, gives error 
 Error - no such file or directory, open '..\index.html'

Resolution - 
- CLI version should be 2.1.0 not beta. If you run ionic -v and have anything other than 2.1.0, run:
npm uninstall -g ionic
npm install -g ionic

Visual Studio Ionic 2 - Error (DEP10402) : Could not locate the start page. You may need to build your project.

On creating new Ionic 2 project templates with Visual Studio 2015, build is failing with the Error  (DEP10402) : Could not locate the start page. You may need to build your project.

Reason - There is no files in www folder by the build.

Resolution -

Update your ionic app scripts to the latest version. It is 1.0.0 for RC5 release.
npm install @ionic/app-scripts@latest --save-dev
Update your package.json to match the following dependencies, remove existing node_modules directory, and then run npm install:
"dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic/storage": "1.1.7",
    "ionic-angular": "2.0.0-rc.5",
    "ionic-native": "2.2.11",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26",
    "sw-toolbox": "3.4.0"
  "devDependencies": {
    "@ionic/app-scripts": "1.0.0",
    "typescript": "2.0.9"


Wednesday, November 18, 2015

Multi Tenancy Identifier for Office 365

When creating Multi Tenancy environment, there is always a identify the Tenant Id, so that corresponding data could be stored and fetched from Datasource.

In TokenHelper.cs there is a public method GetRealmFromTargetUrl(Uri targetApplicationUri) that takes URI of the target sharepoint site as its parameter. This method actually return a string representation of the realm GUID

Realm is unique to each tenant in Office 365 or to each SharePoint farm on-premises. It is possible to discover the realm at run time. So, it is not necessary to cache this information between requests, but it will cost you an extra round trip to SharePoint each time you want to look it up. If you use code similar toTokenHelper.GetRealmFromTargetUrl with the site URL, and cache the result per site (or even per site and per user), you can use this later without making the extra call.

var tenantAdminUri = new Uri(String.Format("https://{0}", tenantStr));

string realm = TokenHelper.GetRealmFromTargetUrl(tenantAdminUri);

You can use Guid now to identify the Tenant.


Monday, December 09, 2013

SharePoint 2013 People Picker Set Value on Form Load

SharePoint 2013 provides client side people picker.
Following snippet helps to set the form value using JQuery and validate the user.

Below JQuery script sets the people picker value, disables the control and sets the background color.

Hope it helps.


Wednesday, December 04, 2013

SharePoint List Form Submit Button (Read Only Permissions)

In custom SharePoint form typically, there is requirement of submit functionality, other than Saving  the list form.

Implementation -

- Create Custom Control inheriting SaveButton class
- Add Custom Control to the rendering template

Good to go ......


Monday, November 05, 2012

SPD Custom Activity - Copy List Item between Folders

SPD 2010 Limitation - SharePoint Designer 2010 does not give option to copy documents between folders in the same document library. Hence, required for custom activity.

Installation -

- Install Custom WSP (SPSPassionSPDActivities.wsp)
- Activate Webapplication Feature - Title - 'SPSPassion SPD Activities Deployment'


Usage -
- In SPD Workflow, add action from 'Custom Actions' category - 'Copy List Item between Folders'
- Configure
○ 'this item' in action
○ 'to Folder' - Set it to Folder in the document library set in 1st Parameter.

Custom Action WSP Download

Friday, November 02, 2012

SharePoint 2013 BCS Error

' The load balancer is not provisioned. Verify the load balancer was provisioned successfully before retrieving endpoint addresses'.  
On first time using SharePoint 2013 BCS Service Application, it gives the error - ' The load balancer is not provisioned. Verify the load balancer was provisioned successfully before retrieving endpoint addresses'.

It has NOTHING to do with WCF services as this was in an RTM environment.
 Recreate the service application and works fine.


Friday, November 19, 2010

Presenting at SharePoint Saturday India - 20th November 2010

SharePoint Saturday India is back. This online event is going to happen on November 20th, 2010. Alpesh did a great job at getting several speakers for this event and there are going to be some parallel sessions happening this time.

I will be speaking about "Introducing Duet Enterprise for Microsoft SharePoint and SAP Applications". This is a level 200 session and would introduce Duet Enterprise. I am excited and a bit nervous too.

You can check the complete list of speakers here @
You can register for this event @

Monday, February 22, 2010

SharePoint Saturday India Registration Open

Join SharePoint architects, developers, and other professionals from India that work with Microsoft Office SharePoint Server 2010 and 2007 for ‘SharePoint Saturday’, on Saturday, April 24th, 2009 for the online event. SharePoint Saturday will be an educational, informative & lively day filled with sessions from respected SharePoint professionals & MVPs, covering a wide variety of SharePoint-orientated topics. SharePoint Saturday is FREE, open to the public and is your local chance to immerse yourself in SharePoint!

We are happy to announce that registration is now open.
So don't delay and register today at

Also, follow us on twitter at @spsindia for more information on the event, with respect to sessions and events.

Cheers ....

Thursday, January 14, 2010

SharePoint 2010 - SharePoint Designer settings

Microsoft Office SharePoint Designer is a free WYSIWYG HTML editor and web design program from Microsoft for SharePoint and other websites and is part of the SharePoint family of products. It is part of the Microsoft Office 2007 & 2010 family.

In SharePoint 2010, administrators would be able to control usage of SharePoint Designer in their environment. Now several administration controls and commands help channel SharePoint Designer into the right hands and onto the right pages. There are following settings available for SharePoint Designer administrator :
  • De-activate SharePoint Designer entirely (but only if it's absolutely necessary!)
  • Disable unghosting of web pages
  • Turn off master page editing
  • Lock the URL of a web site

These settings are available at following places -

  1. Central Administration : 'General Application Settings' group ( below snapshot )

  • On clicking of 'Configure SharePoint Designer Settings' link, product displays the SharePoint Designer settings at webapplication level. ( Below Snapshot ). At webapplication level, all the settings are enabled. Farm Administrators can change their settings at the webapplication level. If SharePoint Designer is disabled at the webapplication level, it also disables the usage at all the containing sitecollections.

2. In Site Settings page in Site Collection : Under 'Site Collection Administration' group.

On clicking of 'SharePoint Designer Settings' link, product displays the SharePoint Designer settings at sitecollection level. ( Below Snapshot ).

SharePoint Designer Groups - Furthermore, a new permission group, called Designer, helps target those users who really need SharePoint Designer.

Wednesday, January 13, 2010

SharePoint 2010 Management Shell - Features CmdLets

The SharePoint Management Shell in SharePoint Foundation 2010 provides an extensive set of Windows PowerShell cmdlets that make development, deployment, and administration of SharePoint 2010 easier and more efficient. Management Shell contains the Powershell cmdlets for SharePoint, by using this we control and manage the SharePoint operations like we done in STSADM command.

Powershell cmdlets for managing SharePoint Features -

PS C:\Users\Administrator> get-command *feature*

CommandType Name Defintion

----------- -------- ------------------------------------

Cmdlet Disable-SPFeature Disable-SPFeature [-Identity...

Cmdlet Enable-SPFeature Enable-SPFeature [-Identity]...

Cmdlet Get-SPFeature Get-SPFeature [[-Identity] <...

Cmdlet Install-SPFeature Install-SPFeature [-Path] <S...

Cmdlet Uninstall-SPFeature Uninstall-SPFeature [-Identi...

Help is available for these SharePoint 2010-specific cmdlets in Windows PowerShell. Type get-help and then type the name of the cmdlet. For example, to find help about SPServiceApplication, type get-help get-SPServiceApplication.

PS C:\Users\Administrator> get-help get-spfeature




Returns the SharePoint Features based on a given scope.


Get-SPFeature [-Identity <SPFeatureDefinitionPipeBind>] [-AssignmentCollection <SPAssignmentCollection>] [-Limit <String>] [<CommonParameters>]

Get-SPFeature [-Identity <SPFeatureDefinitionPipeBind>] [-AssignmentCollect ion <SPAssignmentCollection>] [-Farm <SwitchParameter>] [-Limit <String>] [ <CommonParameters>]

Get-SPFeature [-Identity <SPFeatureDefinitionPipeBind>] [-AssignmentCollection <SPAssignmentCollection>] [-Limit <String>] [-Sandboxed <SwitchParameter>] [-Site <SPSitePipeBind>] [<CommonParameters>]

Get-SPFeature [-Identity <SPFeatureDefinitionPipeBind>] [-AssignmentCollection <SPAssignmentCollection>] [-Limit <String>] [-Web <SPWebPipeBind>] [<CommonParameters>]

Get-SPFeature [-Identity <SPFeatureDefinitionPipeBind>] [-AssignmentCollection <SPAssignmentCollection>] [-Limit <String>] [-WebApplication <SPWebApplicationPipeBind>] [<CommonParameters>]


All SPFeature sets take the Identity parameter, which can be either the relative path of the SharePoint Feature (considered the feature name) or the GUID of a Feature definition. If the Identity parameter is provided, the cmdlets attempt to find the given Feature definition or instance for the given scope. If no parameters are specified, all installed features are returned.

The Get-SPFeature cmdlet behaves differently at each scope, returning the enabled Features at each level. If no scope is provided, all installed Features are returned.

get-spfeature (returns all the installed Feature definitions in the farm )

get-spfeature -farm ( returns all the enabled Feature in the farm)

get-spfeature -webapplication (returns all enabled the Features in the Webapplication)

get-spfeature -site (returns all the enabled Features on the site <<both full trusted and particially trusted code>>)

get-spfeature -site -sandboxed (returns all installed the ptc Feature definitions on the site)

get-spfeature -web (returns all the enabled Features in the Web)


For more information, type: "get-help Get-SPFeature -detailed".

For technical information, type: "get-help Get-SPFeature -full".


Wednesday, January 06, 2010

Up and running with the SharePoint 2010 Public Beta

Although, I am late by few weeks, I started with the installation for SharePoint 2010 Public Beta last week. Although, I have been following and reading lot of stuff on SharePoint 2010 in last few months. Installation was pretty neat. Very good experience as compared to SharePoint 2007 beta.

Although, I missed on installing the prerequisites through the setup and started running the prerequisites on my own. After running the required all the prerequisites, setup kept on giving me the error for 'Windows Server Features or Role Services required by the product are not enabled'. ( Attached snapshot). I tried multiple things - enabled the role services on the server.

I ran the SharePoint 2010 prerequisites which added administration roles. After that SharePoint 2010 installation was pretty straight forward. Way to go …

I am planning to share lot of technical details on different areas of SharePoint 2010 in next few weeks.

Friday, September 11, 2009

Connectbeam - SharePoint Connector

Connectbeam, founded in December, 2005, is a leading provider of enterprise social software applications and the first company to integrate concepts of social bookmarking and tagging with those of social networking. Connectbeam's new Spotlight Connect for SharePoint provides SharePoint users with a single destination for discovering and sharing rich enterprise social bookmarking and tagging information. Spotlight Connect for SharePoint also extends and enhances the native collaboration and discovery capabilities of SharePoint Server 2007.

Spotlight Connect for SharePoint -

Spotlight Connect for SharePoint is deployed as a series of customizable SharePoint Web Parts, including:
• Social Search and Related Content
• Social Graphs
• Bookmarks
• Tags
• Groups
• Connections

Suggested Improvements -

SharePoint Document Library - Connectbeam integration

  • Incase user would like to share information in the document library at the enterprise level, option to publish the information to Connectbeam

  • SharePoint List (Announcements, Custom List etc. ) - Connectbeam integration

    In case users would like to share announcement or a part of it with Connectbeam groups or corresponding Enterprise, it would be a good functionality to have.


Thursday, September 10, 2009

Populating and Creating Business Entities from SharePoint List

Patterns and practices has released a new version of guidance for building collaborative applications.

One of the new functionality provided by the Microsoft group is very useful and generic, w.r.t creating and saving business entities. Concept is based on List based repositories by following below steps -

  1. Business entity class E.g. Customer
  2. Static class that contains the SharePoint field IDs for the list to be used.
  3. Repository class which creates instance of the ListItemFieldMapper class and adds mappings that associate the field IDs to the corresponding property of the business entity

    Please refer - for more details

  4. After business entity and mapping classes are defines, generic functionality could be used to retrieve and save the business entity directly with SharePoint.

    Sample Code -

  • Creating collection for Customer Business Entity:

    public IList<Customer> GetAllCustomers()
    // ...

    using (SPSite site = new SPSite(customerWebUrl))
    using (SPWeb customerWeb = site.OpenWeb())
    SPList customerList = customerWeb.Lists[Constants.CustomerListName];
    CAMLQueryBuilder camlQueryBuilder = new CAMLQueryBuilder();
    SPListItemCollection items = customerList.GetItems(camlQueryBuilder.Build());

    IList<Customer> customers = new List<Customer>();
    foreach(SPListItem item in items)
    Customer customer = listItemFieldMapper.CreateEntity(item);
    return customers;

  • Save a Business Entity to a List

    public void AddCustomer(Customer customer)
    using (SPSite site = new SPSite(customerWebUrl))
    using (SPWeb customerWeb = site.OpenWeb())
    SPList customerList = customerWeb.Lists[Constants.CustomerListName];
    SPListItem customerListItem = customerList.Items.Add();
    this.listItemFieldMapper.FillSPListItemFromEntity( customerListItem, customer);


Sunday, May 03, 2009

SharePoint List Association Manager

While starting on design of SharePoint Custom applications, one of the dilemma which comes - Whether to use SharePoint lists as DataStore or Use RDBMS for storing master and transaction data.

Advantages of SharePoint Lists -

  • Out of box User Interface, reduces development effort
  • Available UI Column types of text, multi line, drop down, radio button, date time etc.
  • Allow lookup columns to define relationships between lists.
  • Sorting and Paging
  • Different Views based on user needs
  • Multiple Records Data Entry
  • Email Alerts
  • Integration with Excel, Access etc.
  • Provides RSS Feeds

Implementing Database Entities as SharePoint Lists, allow users to perform CRUD operations and out-of-box UI with above features.

Limitation of SharePoint Lists for maintaining Database Entities -

  • As SharePoint manages the storage and retrieval of data, Application developers has no control over it, to optimize or tweak the operation.
  • Performance Issues of SharePoint lists : It is well known about SharePoint List performance issue. Refer -
  • Basic Database Features missing in SharePoint list - Unique Constraints, Foreign Key relationships between lists, Database Constraints etc.

SharePoint List Association Manager ( SLAM ) overcomes one of the limitation of defining relationships on SharePoint lists. In nutshell, it creates the Database Tables of Lists and Relationships in External Database. Uses SharePoint eventhandlers to update external database list and relationship tables. Association of lists is based on SLAM xml configuration files. External Database provides independent datastore for reporting, and provides performance gain.

Working with SLAM, there are few things, I found out ( based on my current understanding) -

Explaining by taking example of two SharePoint Lists 'Country' and 'City'. 'Country' has a single text column 'CountryCode'. 'City' has two columns - Text column 'CityName' and lookup column from 'Country' list.

  • No constraints on lists at SharePoint lists. It allows deletion of data from 'Country' list, even if we have relationship data in 'City' list.
  • Allows deletion of parent SharePoint list 'Country', even after relationship defined.
  • Duplicates the data between SharePoint list and External Database Tables.
  • Overhead of maintaining SLAM config, as we have already defined metadata for lists in SharePoint.
  • Performance Issues - Takes approx. 30 minutes to sync SharePoint lists having 20000 records. Concerns on implementations with Enterprise applications with large amount of data.

SLAM doesn't provide Database features of primary keys, constraints, triggers etc.

In my view, SharePoint lists should be mistaken as replacement for Relational Database Management System. For small amount of data and keeping SharePoint lists constraints, might be useful for smaller chunk of data.


Saturday, May 02, 2009

Agile Software Projects - Possible Reasons for failure

Agile's attractiveness with short-burst development cycles, sometimes overshadows the preconditions to rapid-development. The belief in agile is that it's quicker to refactor the product along the way than to try to define everything completely up front, which arguably is impossible.

Potential Reasons for Agile Software Projects failure, keeping Agile Principles in view -

  • Product owners non-commitment to being actively involved throughout the project

  • Not effective collaboration with business colleagues or customers

  • Requirements emerge and evolve, results into Scope changes, creates the risk of ever-lasting projects. Sometimes, No documentation, whatsoever.

  • Wasted Effort on deliverables that don't last

  • Less predictability, at the start of the project and during, about what the project is actually going to deliver.

  • Design flaws - Constant requirements change within short durations, and shorter delivery spans, doesn't allow scope to detailed design. Also, not being aware of high level requirements at the start, doesn't allow to have high level design understanding.

  • Testers needed throughout the project - To ensure quality, additional cost to the project for testing during regular short releases.

  • Development Team Burnout - Agile development is rather intense for developers. The need to really complete each feature 100% within each iteration, and the relentlessness of iterations, can be mentally quite tiring so it's important to find a sustainable pace for the team.

Friday, May 01, 2009

Oracle SharePoint - Integration Points : Opens new possibilities

Oracle Universal Content Management Integration with SharePoint using Web Parts
WebParts to use Oracle ECM as backend and SharePoint as frontend. The web parts also provide for the use of both a SharePoint content repository and a Content Server repository. Content items can be moved between the two systems. This allows consumers who are familiar with SharePoint to interact with the Content Server through a known interface, thus making it easier to contribute and search for content.
Two primary use cases exist for the combination of the Web Parts product and SharePoint:

  • Using SharePoint to collaborate on documents then ‘promoting’ them to a Content Server for storage or use on the enterprise system. This allows users to manage content in SharePoint, including in workflows, collaboration projects, and so forth, but use Content Server for storage and retention.
  • Using a SharePoint front end but storing the content behind SharePoint in a Universal Content Management (UCM) system. This allows users who are familiar with SharePoint to use that interface for many tasks.

SharePoint BDC to connect to Oracle Databases : Business Data Catalog is a feature in MOSS 2007, it provides you with an easy way to integrate line of business data in MOSS 2007, without any code. Following article provides details on creating and implementing BDC for Oracle Databases.

Oracle Universal Records Management Adapter for MOSS 2007 : It Communicates between Records Manager and SharePoint Database Server. The Adapter provides common retention functionality like identification, search and applying policies on the content items.

Oracle Fusion Middleware combining with SharePoint : Oracle Fusion Middleware includes a unique and broad set of capabilities that help IT organizations get control of SharePoint deployments while enhancing the content experience for end users. It help organizations with

  • Share content once the creation phase of the lifecycle is complete by publishing content to an enterprise content management (ECM) system for enterprise access and distribution
  • Comply with industry or government regulations and policies with centralized policy management across distributed SharePoint environments
  • Implement in-place records and retention management—including legal holds—across SharePoint instances
  • Archive content from SharePoint into a single, secure, online repository
    Securely search across multiple libraries and instances
  • Implement information security across and beyond SharePoint environments—including securing documents on laptops, flash drives, and within systems beyond the firewall

Integrate SharePoint content within enterprise and composite applications

Oracle Access Manager Integration with SharePoint : Oracle Access Manager provides a full range of identity management and security functions, including: Web-based single sign-on (SSO), user self-service and self-registration, user provisioning, reporting and auditing, policy management, dynamic groups, and delegated administration. Oracle Access Manager integrates with all leading directory servers, application servers, Web servers, and enterprise applications.
Once Oracle Access Manager has been integrated with SPPS, the Access System handles user authentication through an ISAPI filter for IIS and an ISAPI wild card extension, which enables single sign-on between Oracle Access Manager and SPPS. WSS handles resource request authorization for all SPPS resources.
Such integration enables authenticated users to enjoy SSO access not just to SPPS resources, but also Oracle Access Manager-protected resources, which can reside on the full range of Oracle Access Manager-supported platforms (such as Windows, Solaris, or Linux,) or application servers (such as WebLogic or WebSphere).

Oracle Database as Role and Membership Provider for SharePoint
ASP.NET 2.0 Membership provides a common user authentication and management framework. It also always to extend it by creating a custom Membership Provider when user information is stored in Oracle.
Benefit of ASP.NET 2.0 Membership - With Membership services, we are able to use pre-built user authentication and registration controls instead of writing them from scratch. The end result is less code to write for login, login status, user identity, user registration, and password recovery.
Reference :

Oracle Virtual Directory : Integration with SharePoint :
Oracle Virtual Directory - Creating a secure application environment requires integration of existing user identity information. For some companies, that information is contained in databases. Others use LDAP directories or Windows Domains. For most, this information is scattered across multiple locations and multiple services. Oracle Virtual Directory provides Internet and industry-standard LDAP and XML views of existing enterprise identity information, without synchronizing or moving data from its native locations. This accelerates the deployment of applications and reduces costs by eliminating the need to constantly adapt those applications to a changing identity landscape as user populations are added, changed, or removed.
The benefits of SharePoint and Oracle Virtual Directory Integration are:

  • Allow a single SharePoint instance to use multiple Active Directory domains
  • Allow SharePoint to use identity information stored in non-Active Directory based identity stores including databases
  • Allow SharePoint to use identity information that is split between Active Directory and non-Active Directory data stores including databases

Sunday, October 05, 2008

SharePoint Custom View Actions

Posted a new article on CodeProject to add two new actions on Toolbar for SharePoint lists.

Although, both of these functionalities are available out-of-box, but having these links on the toolbar itself, improves user productivity.

With respect to technical implementation -

  1. For action 'Creating new view, replicating existing view' : Used out-of-box application page 'viewnew.aspx'.
  2. For action 'Delete current view' : Added new application page and deleted the view using SharePoint Object model. However, discovered a issue with SharePoint object model. While deleting the view with object model, there is no check for default view. It deletes the default view also, which removes the list from the Quick Launch bar. Out-of-box Microsoft functionality, is making 'Delete' button visible true or false, on the frontend for ViewEdit.aspx, but it is not checked at the API level.

    For this custom action, I have checked for the default view, and changed the 'Action' Text accordingly.


Wednesday, October 01, 2008

Risks Matrix for SharePoint Projects

Very helpful document on Risk Management for SharePoint Project -

Some important Risk Types -

  • Bad Expectations
  • Poor Terms definition
  • Poor Understanding
  • No value proposition
  • No compelling reason
  • No Launch
  • Poor Adoption

    SharePoint Internet Sites -

  • Major Risks are poor understanding, no Launch & poor Understanding.
  • The greatest issue with Internet site is how SharePoint processes requests and how it will fit into the environment. While SharePoint is capable of being used in Internet applications, it's not designed for this purpose. It will exhibit limitations when used in the anonymous authentication environment of the Internet.

Tuesday, September 30, 2008

Custom DataSheet View Using ListNet ActiveX Control

Introduction -

SharePoint DataSheet Page is used for editing lists in multiple record grid format. DataSheet view uses ListNet control, which is an ActiveX control. This control is also works in conjunction with the ListViewWebPart class to provide users with a dataview for editing lists in Microsoft Windows SharePoint Services.

ListNet control is defined in the STSLIST.DLL file, a dynamic-link library (DLL) that is installed on the client during 2007 Office system setup in the Local_Drive:\Program Files\Microsoft Office\OFFICE12 directory.

Analyzing out-of-box 'Edit in DataGrid' Page -

On clicking on 'Edit in DataGrid', redirection to 'AllItems.aspx' (~site/{DocLib}Forms/AllItems.aspx?ShowInGrid=True&View={ViewGuid}) happens.

In summary, looking at the source of the page, it contains Script tag, which calls Javascript function, RenderActiveX. RenderActiveX has the object tag with class id={65BCBEE4-7728-41a0-97BE-14E1CAE36AAE}.

Parameters which are set on the page, to render the ActiveX are - ListName, ViewGuid, ListWeb. ListData, ViewSchema, ListSchema.

In summary, below is the script tag -
<SCRIPT>RenderActiveX("<OBJECT id='STSListControlWPQ2' name='STSListControlWPQ2' classid=CLSID:65BCBEE4-7728-41a0-97BE-14E1CAE36AAE PARAM NAME='ListName' VALUE='{ListID} PARAM NAME=ViewGuid VALUE={ViewID} PARAM NAME=ListWeb VALUE={WebUrl} PARAM NAME='ListData' VALUE={ListData} PARAM NAME=ViewSchema VALUE={ViewSchema} PARAM NAME='ListSchema' VALUE={ListSchema} PARAM NAME='ControlName' VALUE='STSListControlWPQ2' > </OBJECT>");</SCRIPT>

Custom Application Page using ListNet ActiveX Page -
Below is some of the code snippet used in the application page. Application Page is passed two query parameters ListId and WebId, to create dynamic view for the list in the web.

<script runat="server">
SPWeb web;
SPList list;
string ListData, ViewSchema, ListSchema;

protected override void OnLoad(EventArgs e)
//Reading ListId querstring parameter
Guid listGuid = new Guid(Request.QueryString.Get("ListId"));

//Reading WebId querstring paramter
Guid webGuid = new Guid(Request.QueryString.Get("WebId"));

SPSite site = SPContext.Current.Site;
web = site.OpenWeb(webGuid);
list = web.Lists[listGuid];

//Custom string functions, STSHtmlEncode & STSScriptEncode to encode the string
ListData = STSScriptEncode(STSHtmlEncode(list.Items.Xml));
ViewSchema = STSScriptEncode(STSHtmlEncode(list.DefaultView.SchemaXml));
ListSchema = STSScriptEncode(STSHtmlEncode(list.SchemaXml));


<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<SCRIPT>RenderActiveX("\u003cOBJECT id=\u0022STSListControlWPQ2\u0022 name=\u0022STSListControlWPQ2\u0022 classid=CLSID:65BCBEE4-7728-41a0-97BE-14E1CAE36AAE width=\u002299\u0025\u0022 tabindex=\u00221\u0022\u003e\u003cPARAM NAME=\u0022ListName\u0022 VALUE=\u0022{<%=list.ID.ToString()%>}\u0022\u003e\u003cPARAM NAME=\u0022ViewGuid\u0022 VALUE=\u0022{<%=list.DefaultView.ID.ToString()%>}\u0022\u003e\u003cPARAM NAME=\u0022ListWeb\u0022 VALUE=\u0022<%=web.Url%>\u002f_vti_bin\u0022\u003e\u003cPARAM NAME=\u0022ListData\u0022 VALUE=\u0022<%=ListData%>\u0022\u003e\u003cPARAM NAME=\u0022ViewSchema\u0022 VALUE=\u0022<%=ViewSchema%>\u0022\u003e\u003cPARAM NAME=\u0022ListSchema\u0022 VALUE=\u0022<%=ListSchema%>\u0022\u003e\u003cPARAM NAME=\u0022ControlName\u0022 VALUE=\u0022STSListControlWPQ2\u0022\u003e\u003cp class=ms-descriptiontext\u003eThe Datasheet view of this list cannot be displayed. Please wait while the page is redirected to Standard view. If your list does not appear in a few moments, \u003cA onclick=\u0022javascript:GCNavigateToNonGridPage\u0028\u0029; javascript:return false;\u0022 href=\u0022?ShowInGrid=False\u0022 target=_self\u003eopen the list in Standard view\u003c\u002fA\u003e\u003c\u002fp\u003e\u003c\u002fOBJECT\u003e");



Monday, September 29, 2008

Switching between WebPart Pages Modes

Frequently, need for switching between different modes in WebPart page programmatically is felt. For this we have used using various SharePoint JavaScript functions like MSOTlPn_ShowToolPaneWrapper, MSOLayout_ToggleLayoutMode etc. have been used in the past.New approach for the switching between WebPart modes would be to use WebPartManager DisplayModes collection and setting DisplayMode.Below attached sample webpart code, achieves the same. When you load the page in a browser, Display Mode drop-down list control is populated with display modes and is used to switch to different display modes. To edit controls, select Edit in the drop-down list control. When you are finished, select Browse in the Display Mode drop-down list control to return the page to a normal view. To add controls to the page, switch to catalog mode.

using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

namespace SPUtil

public class EditModeSwitchWebPart : System.Web.UI.WebControls.WebParts.WebPart
DropDownList dropdownDisplayMode;
protected override void CreateChildControls()
dropdownDisplayMode = new DropDownList();
dropdownDisplayMode.AutoPostBack = true;
dropdownDisplayMode.SelectedIndexChanged += new EventHandler(dropdownDisplayMode_SelectedIndexChanged);

foreach (WebPartDisplayMode wpDisplayMode in WebPartManager.DisplayModes)
WebPartDisplayMode enabledWpDisplayMode = WebPartManager.SupportedDisplayModes[wpDisplayMode.Name];
if (enabledWpDisplayMode != null)

void dropdownDisplayMode_SelectedIndexChanged(object sender, EventArgs e)
if(this.dropdownDisplayMode.SelectedItem != null)
this.WebPartManager.DisplayMode = WebPartManager.DisplayModes[dropdownDisplayMode.SelectedValue];

Wednesday, August 20, 2008

Redirecting to custom application page, after uploading documents

Overview -
SharePoint Upload.aspx page is used for uploading documents from the document libraries and other lists. Upload.aspx is called, by passing various Query String parameters like ListId, Source, MultipleUpload etc. MultipleUpload parameter is used to display controls for single or multiple file upload. After uploading the documents, code redirection happens to AllItems.aspx or EditForm.aspx, based on scenarios. Since, redirection happens in code behind, creating custom application page to perform upload function and redirecting, serves the purpose. To start with, approach looks like, lot of development effort. However, it is very simple, since we are reusing the functionality provided in upload.aspx. This enables you to inject specific business rules and processes for adding files to the library. This also enables to write specific business processes as well custom file processing.

Creation of custom aspx page with code behind library. Instead of creating a completely new Upload page, you will derive from the existing Upload page and functionality and modifying the functionality you want. To do this, you reference the Microsoft.SharePoint and Microsoft.SharePoint.ApplicationPages assemblies in your project. Then you create a class that derives from the Microsoft.SharePoint.ApplicationPages.UploadPage class. This class uses the Microsoft.SharePoint and Microsoft.SharePoint.ApplicationPages namespaces. The functionality that we want is redirect the users to custom application page.

C# Code -
namespace UploadRedirect
public class CustomUpload : Microsoft.SharePoint.ApplicationPages.UploadPage
protected override void OnLoad(EventArgs e)
//Set the literal control text to redirect page.
this.ConfirmationURL.Text = { Complete Url to the Redirect Page }


Creating the ASPX Page –
Create new custom aspx page, based on Upload.aspx from Layouts directory. Add the reference of above creating assembly on the top of custom aspx page. Rest of the content remains the same. Deploy the assembly in Global Assembly Cache and custom upload aspx page in layouts directory. Test the page, by passing the same query string parameters as being passed in upload.aspx.

Redirecting the User to the New Upload Page -
Change the links for Upload and Multiple Upload in the Document Library. There can be different approaches for the same. Custom Document Library Template with the path to custom upload page, would be one of them. Using Javascript of overriding the links, can be another.

References -
Microsoft MSDN Article -
Preventing Record Modification but Allowing Metadata Modification by Overriding the Upload Page in Windows SharePoint Services 3.0


Search This Blog


The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway. All posts are provided "AS IS" with no warranties, and confers no rights. In addition, my thoughts and opinions often change, and as a weblog is intended to provide a semi-permanent point in time snapshot you should not consider out of date posts to reflect my current thoughts and opinions.

Popular Posts

Total Pageviews