Analyzing SharePoint Solutions with MOSCAF – Part II

By Danielle Arad - January 16, 2014
3 min read

In this article I will continue talking about how to use the capabilities provided by MSOCAF (Microsoft SharePoint Online Code Analysis Framewor) for auditing a SharePoint environment in terms of .WSP solutions deployed. If you remember, in my last post about MSOCAF we simply reviewed how to install and use the tool in a CloudShare SharePoint development environment. In this blog post I will continue showing you how MSOCAF is a great tool for analyzing SharePoint solutions and detect any problems introduced by them in a SharePoint farm.

Analyzing a set of WSP solutions to be deployed in a SharePoint environment

In my scenario I have a set of WSP solutions provided by my development team that need to be reviewed and analyzing before being deployed to the pre-production and production environments:

  • MSOCAF is perfect in this situation since it allows to analyze several SharePoint solutions in the same process. As you can see in the screenshot, MSOCAF has detected some issues and errors in the analysis. In order to have a more detailed information about the problems found by MSOCAF, I recommend you to use the “Export to excel” and / or “Export to browser” functionality provided by the tool.


  • Both approaches, “Export to Excel” or “Export to Browser”, provide a great detail about all the errors and warnings generated by MSOCAF after analyzing all the WSPs. As you can see in the Excel file generated, you have the ability to filter the data applying different filters like the test cases used by MSOCAF: “Design”, “Memory management”, “Security”, etc. Additionally, you can apply additional filters in order to narrow specific errors and warnings.


  • If we opt to use the “Export to Browser” option, the analysis results are shown in a different way compared to the Excel one. Basically, for each analysis rule applied by MSOCAF we can see the problems and warnings found during the analysis process.


  • Of course, in order to understand the analysis rules applied by MSOCAF you can always go back in the analysis wizard and review the test cases being applied.


  • As you can see, MSOCAF applies a set of test cases labeled as “Microsoft Online custom rules”. These test cases allow to measure various aspects in the WSPs analyzed such as possible performance problems, design errors, and so on. If you want to know the details about these cases, it’s recommendable to review MOSCAF’s Help.


  • MOSCAF’s Help file includes a “Custom Rules” section where you can review the details for each rule applied in each test case.


  • For instance, the details for “Check for Use of SP.List.Items” rule are the following:

(a) Check for Use of SPList.Items

If any of the instructions contains the SPList.Items object, MSOCAF will generate an error.

If you encounter problems:

Remove the SPList.Items object from the instructions. For retrieving items in a list, use SPList.GetItems (SPQuery query).For more details, see the MSDN article Best Practices: Common Coding Issues When Using the SharePoint Object Model.

And that’s all in this second article about how to use MSOCAF to analyze SharePoint Solutions. Happy CloudSharing!