Blog Archives

SharePoint 2016 – Project Template for Visual Studio Available

Microsoft Office Developers Tools for Visual Studio 2015 includes the templates for developing SharePoint farm and sandboxed solutions for SharePoint 2016.


Before you install,  you need to have Visual Studio 2015 Installed





Add a custom content type to a custom list definition

To add a custom content type to a custom list definition , the simple way to do is to add some entries in the schema.xml of the list.

Just add the ContentTypeRef of the contents types you want to use:

  • Add the DisallowContentTypes=”FALSE tag to the Elements.xml for the list;
  • Add the EnableContentTypes=”TRUE tag to the List Definition Schema.xml;

Sometimes i don’t really know the reason but some of the fields are not shown when trying to create a new item in the list.

I solved this problem by copying the field definition in the contents type to the schema.xml of the list. and it works fine.

Add a Custom Actions on Site Settings Menu – SharePoint

If you want to add a custom Action on Site Settings menu, you just need follow the steps bellow.

On your solution, add an Empty Element -> (Add > New Item > Empty Element)

When you add an Empty Element, a xml file was created too, you just need copy-past the following code to Elements.xml file and save:

(green letters represents what you need to change)

Code Example:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
  Title="Menu of Actions - FcSharePoint" 

  Title="Action FcSharePoint"    
<UrlAction Url="~site/_layouts/Pages/Test.aspx"/> 

CustomAction Element

  ContentTypeId = "Text"
  ControlAssembly = "Text"
  ControlClass = "Text"
  ControlSrc = "Text"
  Description = "Text"
  GroupId = "Text"
  Id = "Text"
  ImageUrl = "Text"
  Location = "Text"
  RegistrationId = "Text"
  RegistrationType = "Text"
  RequireSiteAdministrator = "TRUE" | "FALSE"
  Rights = "Text"
  Sequence = "Integer"
  ShowInLists = "TRUE" | "FALSE"
  ShowInReadOnlyContentTypes = "TRUE" | "FALSE"
  ShowInSealedContentTypes = "TRUE" | "FALSE"
  Title = "Text">

Check if Current User is member of SharePoint Group’s – Programmatically c#

In SharePoint, we have the 3 predetermined permission groups:

  • Visitors
  • Members
  • Owners

You can see this permissions grpups in the /_layouts/permsetup.aspx page.

(Site settings->People and Groups->Settings->Setup groups)

There are properties on the SPWeb class:

  • SPWeb.AssociatedVisitorGroup
  • SPWeb.AssociatedMemberGroup
  • SPWeb.AssociatedOwnerGroup

Programmatically you can check if current user are in one of those Groups, using the following code:

bool isVisitor = false;
bool isMember = false;
bool isOwner = false;

SPWeb web = SPControl.GetContextWeb(System.Web.HttpContext.Current);
SPContext currentContext = SPContext.Current;
if (currentContext != null && currentContext.Web.CurrentUser != null)
   SPGroupCollection webGroups = web.CurrentUser.Groups;
   if (webGroups != null && webGroups.Count > 0)
       foreach (SPGroup group in web.Groups)
         if (group.ToString() == web.AssociatedVisitorGroup.ToString())
            isVisitor = web.IsCurrentUserMemberOfGroup(group.ID);
         if (group.ToString() == web.AssociatedMemberGroup.ToString())
            isMember = web.IsCurrentUserMemberOfGroup(group.ID);
          if (group.ToString() == web.AssociatedOwnerGroup.ToString())
            isOwner = web.IsCurrentUserMemberOfGroup(group.ID);
if(isVisitor == true)
 // User is Visitor
if(isMember == true)
  // User is Member
if(isOwner == true)
  // User is Owner