SharePoint Code Analysis Framework (SPCAF) BETA Free

Finally Matthias Einig and Torsten Mandelkow published the SharePoint Code Analysis Framework (SPCAF) as the first public beta release.

Get it from here
Watch a demo video here

The SharePoint Code Analysis Framework (SPCAF) provides tools to analyze SharePoint code. This includes

  • SharePoint solutions (.wsp) for SharePoint 2007 / 2010 / 2013
  • SharePoint 2013 apps

SPCAF cannot only analyze assemblies like other tools as FxCop or SPDisposeCheck. It can also analyze all the XML code in SharePoint packages like Features, ContentTypes, ListTemplates and all the other files like controls (.ascx), pages (.aspx) and master pages (.master) etc.

SPCAF can be used directly in Visual Studio 2012 or 2010 to analyze SharePoint projects. It also provides a client application to analyze existing WSP packages, can be integrated into a Team Build via a custom build activity, it can be run on command line or as MSBuild task during each local build.


Sample analysis results

Who should use it?

  • SharePoint Architects can ensure proper application design and detect violations against best practices
  • SharePoint Developers can ensure that their code is correct and that errors in XML code can be found early directly in Visual Studio and not only after deployment to SharePoint.
  • SharePoint Quality Assurance can ensure that WSP packages are developed according to the best practices and the e.g. Customization Policies are not violated.
  • IT Pros can ensure that the WSP files does not contain “dangerous” code and that they can install the packages without fear. The inventory reports gives a detailed overview about the contents in the packages and is a good documentation of the code.

Use SPCAF directly in Visual Studio

Get Errors and Warnings and open the files directly in VS

Visualize Dependencies

Use the client application to analyze existing WSPs or APPs

MSDN Blog Post


E-Book Gallery for Microsoft Technologies

Download content for ASP.NET, Office, SQL Server, Windows Azure, SharePoint Server and other Microsoft technologies in e-book formats. Reference, guide, and step-by-step information are all available. All the e-books are free. New books will be posted as they become available at here

E-Books in English

Lync Microsoft Lync Server 2013 Step by Step for Anyone 
Office Deployment guide for Office 2013
First Look: Microsoft Office 2010
Microsoft Office 365: Connect and Collaborate Virtually Anywhere, Anytime
Microsoft Office 365 for professionals and small businesses: Help and How To
Security and Privacy for Microsoft Office 2010 Users
SharePoint Explore SharePoint 2013
Deployment guide for SharePoint 2013
Create a Balanced Scorecard
Configure Kerberos Authentication for SharePoint 2010 Products
SharePoint Server for Business Intelligence
Get started with SharePoint Server 2010
Deployment guide for SharePoint Server 2010
Upgrading to SharePoint Server 2010
Profile synchronization guide for SharePoint Server 2010
Remote BLOB storage for Microsoft SharePoint Server 2010
Governance guide for Microsoft SharePoint Server 2010
Business continuity management for SharePoint Server 2010
Technical reference for Microsoft SharePoint Server 2010
SQL Server 5 Tips for a Smooth SSIS Upgrade to SQL Server 2012
A Hitchiker’s Guide to Microsoft StreamInsight Queries
Books Online: Backup and Restore of SQL Server Databases
Books Online: Data Analysis Expressions (DAX) Reference
Books Online: Data Mining Extensions (DMX) Reference
Books Online: Data Quality Services
Books Online: High Availability Solutions
Books Online: Master Data Services
Books Online: Monitor and Tune for Performance
Books Online: Multidimensional Expressions (MDX) Reference
Books Online: SQL Server Distributed Replay
Books Online: Transact-SQL Data Definition Language (DDL) Reference
Books Online: Transact-SQL Data Manipulation Language (DML) Reference
Books Online: XQuery Language Reference
Extracting and Loading SharePoint Data in SQL Server Integration Services
Introducing Microsoft SQL Server 2008 R2
Introducing Microsoft SQL Server 2012
Master Data Services Capacity Guidelines
Microsoft SQL Server AlwaysOn Solutions Guide for High Availability and Disaster Recovery
Microsoft SQL Server Analysis Services Multidimensional Performance and Operations Guide
Optimized Bulk Loading of Data into Oracle
Planning Disaster Recovery for Microsoft SQL Server Reporting Services in SharePoint Integrated Mode
QuickStart: Learn DAX Basics in 30 Minutes
SQL Server 2012 Tutorials: Analysis Services – Data Mining
SQL Server 2012 Tutorials: Analysis Services – Multidimensional Modeling
SQL Server 2012 Tutorials: Analysis Services – Tabular Modeling
SQL Server 2012 Tutorials: Reporting Services
SQL Server 2012 Tutorials: Writing Transact-SQL Statements
SQL Server 2012 Upgrade Technical Guide
SQL Server Community FAQs Manual
Visual Studio Moving to Microsoft Visual Studio 2010
Upgrade Team Foundation Server 2012: the ultimate upgrade guide
Web Development Deploying an ASP.NET Web Application to a Hosting Provider using Visual Studio
Developing Modern Mobile Web Apps
The Entity Framework 4.0 and ASP.NET Web Forms – Getting Started
Getting Started with ASP.NET 4.5 Web Forms (Beta)
Getting Started with the Entity Framework 4.1 using ASP.NET MVC
Intro to ASP.NET MVC 4 with Visual Studio (Beta)
Introducing ASP.NET Web Pages 2
Project Silk: Client-Side Web Development for Modern Browsers
Windows Deploying Windows 7: Essential Guidance
Programming Windows 8 Apps with HTML, CSS, and JavaScript
Windows Azure Autoscaling Application Block and Transient Fault Handling Application Block Reference
Building Elastic and Resilient Cloud Applications – Developer’s Guide to the Enterprise Library 5.0 Integration Pack for Windows Azure
Building Hybrid Applications in the Cloud on Windows Azure
Create Your First Application – Node.js and Windows Azure
Drupal on Windows Azure
Migrating Data-Centric Applications to Windows Azure
Moving Applications to the Cloud, 2nd Edition
Using Windows Azure Mobile Services to Cloud-Enable your iOS Apps
Using Windows Azure Mobile Services to Cloud-Enable Your Windows Phone 8 Apps
Using Windows Azure Mobile Services to Cloud-Enable your Windows Store Apps in C#
Using Windows Azure Mobile Services to Cloud-Enable Your Windows Store Apps in JavaScript
Windows Azure and SQL Database Tutorials
Windows Azure Prescriptive Guidance
Windows Azure Service Bus Reference
Windows Phone Developing an Advanced Windows Phone 7.5 App that Connects to the Cloud
Programming Windows Phone 7
Windows Server A Guide to Claims-Based Identity and Access Control, Second Edition
Introducing Windows Server 2008 R2
Introducing Windows Server 2012
Understanding Microsoft Virtualization Solutions: From the Desktop to the Datacenter, Second Edition
Career Own Your Future: Update Your Skills with Resources and Career Ideas from Microsoft

Forms that require the domain permission level contain features that access information on a network, such as data connections, linked images, and code

This was really strange (but funny) issue!!

I created few of the InfoPath Forms and published them into the SharePoint 2010 Library.

After a while, I got a request from another Developer asking me for the forms as they wanted to update and make few changes into the existing form. (So I did give them the forms 😛 )

After a while they come running to me and said that they are getting an error while opening the form and below is the error:

“This form cannot be opened because it requires the domain permission level and it currently has restricted permission.”

And another error:

“Forms that require the domain permission level contain features that access information on a network, such as data connections, linked images, and code.”

InfoPath Error


Can’t a developer just edit the InfoPath form of an another Developer?!?!

I asked the developer to send me the list of steps he is following while trying to open the file (and that’s the catch).

What he was trying is “Double-click on the form to open it?!?!?!?!”

Solution: Right Click on the form and Select “Design” 🙂

Have fun & Enjoy!!

jqGrid Implementation Using SpServices in SharePoint


Today’s SPServices Story comes from Prateek Kulkarni in Bengaluru, India. Prateek posted this originally on the C# Corner site as jqGrid Implementation Using SpServices in SharePoint.

As with several of the earlier SPServices Stories posts, Marc found this one interesting because it shows how to use SPServices with another framework to render the results obtained from the Web Services calls.

Marc have had several people telling him that there isn’t enough “story” to these SPServices Stories. Have a better one? Let him know!

jqGrid with SPServices

This article is regarding implementation of jqGrid(demo) using SPService(CodePlex)

SPService is a jQuery library which abstracts SharePoint’s Web Services and makes them easier to use. It also includes functions which use the various Web Service operations to provide more useful (and cool) capabilities. It works entirely client side and requires no server installation.

Use of SPService and jQuery is best explained at Marc’s blog.

Following Js files are needed for JqGrid Implementation with SPService

  • jquery-1.8.2.js
  • grid.locale-en.js
  • jquery.jqGrid.min.js  // Structuring jqGrid
  • json2-min.js  // Parsing data to json format
  • jquery.SPServices-0.7.2.js  // For getting the list items

Css file required

  • ui.jqgrid.css  //Style sheet of Grid

HTML controls for jqGrid are as mentioned below.

1 <div id='tblMain' style="float:left">
2   <table  id="list" ></table>
3   <div id="pager" style="text-align:center;"></div>
4 </div>

Loading JqGrid on the page load:

1 jQuery("#list").jqGrid({
2   datatype: GetMyData,
3   colNames:["Project ID","Project Name","Delivery Manager","ApprovalStatus"],
4   colModel:[{name:'ProjectId',index:'ProjectId',align:'left',sortable: true},
5   {name:'ProjectName',index:'ProjectName',align:'left',sortable: true },
6   {name:'DeliveryManager',index:'DeliveryManager',align:'left',sortable:true},
7   {name:'ApprovalStatus',index:'ApprovalStatus',align: 'left',sortable: true }
8     ],
9   pager: true,
10   pager: '#pager',
11   pageinput: true,
12   rowNum: 5,
13   rowList: [5, 10, 20, 50, 100],
14   sortname: 'ApprovalStatus',
15   sortorder: "asc",
16   viewrecords: true,
17   autowidth: true,
18   emptyrecords: "No records to view",
19   loadtext: "Loading..."
20 });

In the above jqGrid load function Marc has mentioned the datatype for the grid as GetMyData() which is a function that gets triggerred first.

The GetMyData method has function GetDataOnLoad which uses the SpServices which has the basic operation of getting the list items i.e. GetListItems, which need optional CAML Query property which will fetch the data from list with some WHERE clause.

In the code Marc has a list called ProjectDetailsList which will contain details of some projects which are inserted by some Project Manager or delivery manager. So the requirement was when a user log in to the system one should get the current login user name and pass the same user name to the “where” clause of query so the grid will contain data of projects to which the current logged in user is assigned as PM or DM.

To get the current login user am using SpServices Operation SpGetCurrentUser.

The method GetTheOrderByType function will make the query part for SpServices.

The functions code is as follows:

1 function ForGettingUserName() {
2   var userName = $().SPServices.SPGetCurrentUser({
3       fieldName : "Title",
4       debug : false
5     });
6   return userName;
7 }
9 function GetMyData() {
10   sortIdexName = jQuery("#list").getGridParam("sortname"); //Maintaining Consitant SortName after the Sortcol event
11   sortOrderName = jQuery("#list").getGridParam("sortorder"); //Maintaining Consistant Sort Order
12   Query = GetTheOrderByType(sortIdexName, sortOrderName);
13   var CAMLViewFields = "<ViewFields>" +
14      "<FieldRef Name='projectName' /><FieldRef Name='projectID' />"
15      "<FieldRef Name='Title' /><FieldRef Name='deliveryManager' />"
16      "<FieldRef Name='projectSQA' /><FieldRef Name='approvalStatus' />"
17      "<FieldRef Name='projectStartDate' /><FieldRef Name='projectEndDate' />"
18      "<FieldRef Name='sqasiteurl' /><FieldRef Name='ID' />"
19      "</ViewFields>";
20   GetDataOnLoad(Query, CAMLViewFields);
21 }
22 Function for Getting the Query Type and the particular WHERE CLAUSE TO send the Query to GetListItem function
23 function GetTheOrderByType(index, sortOrder, userName) {
24   var OrderByType;
25   if (index == "ProjectName") {
26     if (sortOrder == "desc") {
27       OrderByType = "<Query>" +
28          "<Where><Or>" "<Eq>" "<FieldRef Name='deliveryManager'/><Value Type='Text'>"
29          + userName + "</Value>" "</Eq>"
30          "<Eq><FieldRef Name='projectManager'/><Value Type='Text'>"
31          + userName + "</Value></Eq>" "</Or></Where>" +
32          "<OrderBy><FieldRef  Name='projectName' Ascending='FALSE' /></OrderBy>" +
33          "</Query>";
34     else {
35       OrderByType = "<Query>" +
36          "<Where><Or>" "<Eq>" "<FieldRef Name='deliveryManager'/><Value Type='Text'>"
37          + userName + "</Value>" "</Eq>"
38          "<Eq><FieldRef Name='projectManager'/><Value Type='Text'>"
39          + userName + "</Value></Eq>" "</Or></Where>" +
40          "<OrderBy><FieldRef  Name='projectName' Ascending='FALSE' /></OrderBy>" +
41          "</Query>";
42     }
43   else if (index == "ApprovalStatus") {
44     if (sortOrder == "desc") {
45       OrderByType = "<Query>" +
46          "<Where><Or>" "<Eq>" "<FieldRef Name='deliveryManager'/><Value Type='Text'>"
47          + userName + "</Value>" "</Eq>"
48          "<Eq><FieldRef Name='projectManager'/><Value Type='Text'>"
49          + userName + "</Value></Eq>" "</Or></Where>" +
50          "<OrderBy><FieldRef  Name='approvalStatus' Ascending='FALSE' /></OrderBy>" +
51          "</Query>";
52     else {
53       OrderByType = "<Query>" +
54          "<Where><Or>" "<Eq>" "<FieldRef Name='deliveryManager'/><Value Type='Text'>"
55          + userName + "</Value>" "</Eq>"
56          "<Eq><FieldRef Name='projectManager'/><Value Type='Text'>"
57          + userName + "</Value></Eq>" "</Or></Where>" +
58          "<OrderBy><FieldRef  Name='approvalStatus' Ascending='FALSE' /></OrderBy>" +
59          "</Query>";
60     }
61     return OrderByType;
62   }
64   //This function gets the data from List using SpServices
65   Function GetDataOnLoad(Query, CAMLViewFields) {
66     $().SPServices({
67       operation : "GetListItems",
68       async : false,
69       listName : "ProjectDetailsList",
70       CAMLQuery : Query,
71       CAMLViewFields : CAMLViewFields,
72       completefunc : processResult
73     });
74   }

The processResult is the function which formats the data which can be converted to Json and adds to the JqGrid.
The reason of formatting of data in the following particular format is to make it readable by the Json parser which is json2.js file. Marc has implemented the same JqGrid in application with AJAX calls where it was returning the data in this format and some other bloggers also used the same data format in the MVC or application with the help for JsonHelper class which mainly formats the data returned from the DB

1 //Processing the XML result to formatted Json so that We can bind data to grid in Json format
2 function processResult(xData, status) {
3   var counter = 0; // Gets the total number of records retrieved from the list (We can also use xData.ItemCount method for counting the number of rows in the data )
4   var newJqData = "";
6   $(xData.responseXML).SPFilterNode("z:row").each(function () {
8     var JqData;
9     if (counter == 0) {
10       JqData = "{id:'" + $(this).attr("ows_projectID") + "',"
11          "cell:[" "'" + $(this).attr("ows_projectID") + "','" +
12         $(this).attr("ows_projectName") + "','" +
13         $(this).attr("ows_deliveryManager") + "','," +
14         "]}";
15       newJqData = newJqData + JqData;
16       counter = counter + 1;
17     else {
18       var JqData = "{id:'" + $(this).attr("ows_projectID") + "',"
19          "cell:[" "'" + $(this).attr("ows_projectID") + "','" +
20         $(this).attr("ows_projectName") + "','" +
21         $(this).attr("ows_deliveryManager") + "','," +
22         "]}";
23       newJqData = newJqData + JqData;
24       counter = counter + 1;
25     }
27   });
28   FinalDataForGrid(newJqData, counter);
29 }

That’s it. Add the data to the grid with the div control and the other page number calculation is for showing the pager.

1 function FinalDataForGrid(jqData, resultCount) {
2   dataFromList = jqData.substring(0, jqData.length - 1);
3   var currentValue = jQuery("#list").getGridParam('rowNum');
4   var totalPages = Math.ceil(resultCount / currentValue);
5   var PageNumber = jQuery("#list").getGridParam("page"); // Current page number selected in the selection box of the JqGrid
6   //formatting rows
7   newStr = "{total:" '"' + totalPages + '"' "," "page:" '"' + PageNumber + '"'","
8      "records:" '"'
9      + resultCount + '"' + ","
10      "rows:"
11      "[" + dataFromList + "]}";
12   var thegrid = jQuery("#list")[0];
13   thegrid.addJSONData(JSON.parse(newStr)); //Binding data to the grid which is of JSON Format
14 }

And the grid works fine and fast on paging, sorting and also even search, we can make the particular column as hyperlink which Marc will blog in the next part. Sample grid is as follows and this grid has some extra columns then the mentioned in above code.

This Post was originally posted at Marc D Anderson’s Blog

Displaying attachment link in a SharePoint custom list form – “DispForm.aspx”

Recently while working with SharePoint lists I required to customize the out-of-the-box list item display form “DispForm.aspx” to present a design-frenzy item view format.

During the modification process, I never assumed that the list item attachments would abruptly dissapear from the display form. All I was looking to do was to display the list item in a good looking format by modifying the XSLT, but the attachments were gone!

Lesson Learnt: Never modify the out-of-the-box list item display form “DispForm.aspx”. Create a new one if you need to and call it “DispForm_WhateverYouCallIt.aspx”

Now the attachments that were gone seemed quite easy to be brought back on the page. It needed a SharePoint control AttachmentsField that went missing from the picture. Below is the code that you need to add into the XSLT template dvt_1.rowview (into your custom form) that constructs theDataFormWebPart that SharePoint Designer creates for you when you insert a Custom List Form:

Infopath cannot save the following form: http://servername….. This document library was either renamed or deleted, or network problem are preventing the file from being saved. If this problem persists, contact your administrator.

This error started appearing every time I try to publish a particular template back to the library.  I’ve been working with this template all week without any issues until this.  The document library wasn’t renamed or deleted.  I can edit and publish changes to form library templates in other site collections without a problem.  This particular form library template does not contain any custom code.

Now in this case, there are couple of things you should try as suggested by Carl G – DC

  • Go to another PC and log-in into windows with your account, then open the template from the library and publish back to the library
  • Open IP Designer on your machine, open an old version of the form, and choose File | Publish | SharePoint Server and choose the same library
  • Clear the InfoPath cache (Start | Run | InfoPath /cache clearall)
  • From IP Designer, File | Publish | SharePoint Server, but this time enter full URL of file path (including the template.xsn)
  • Navigated to Library Settings | Re-link documents to this library, then selected the only submitted document and clicked Re-link All.  Then edit the template and try to publish back to the library
  • Open IP Designer on your machine, open an old version of the form, and choose File | Publish | SharePoint Server and choose to publish to a new library.  Then edit the template in that new library and published again
  • Also try cranking up monitoring for InfoPath Forms Services in Central Admin, repeat the same test of editing and publishing the template and then check the Windows Events Logs on all SharePoint servers in the farm.

Show Description/Comment History in Display Form of SharePoint Designer 2007

Hey Guys,

Yeah, it seems little weird for me to go back working on SharePoint (or may be MOSS) 2007 but it was for a while  🙂

So, when you have a requirement to showing Description/Comments History in your display form, for which, the field was multi line text, what would you do?


For Description, it’s pretty straight forward!!

<xsl:value-of select=”@Comments” />

But for Comments History, in my edit page, I was able to see the Comments History like this:


In HTML Code, I show something like below,

<xsl:value-of select=”@Comments” />

but nothing comes under the Comments Text in my Display form!!  😦

I went and edited the Edit Form where it does shows the comment history, so how to show the comment history in Display form??

It’s simple (looks simple when you know it 🙂 )

Just Changed the below code,

<xsl:value-of select=”@Comments” />


<SharePoint:AppendOnlyHistory FieldName=”Comments” runat=”server” ControlMode=”Display” ItemId=”{@ID}”/>

That’s it.

Thanks & Enjoy!! 🙂

%d bloggers like this: