Posts Tagged ‘group’

SharePoint 2013: Exception while creating default associated groups through PowerShell

While new site collection provisioned default security groups been provisioned when we create it from central administration but not when the site collection was created using script. For that we need to call a function ‘CreateDefaultAssociatedGroups’. This method actually created default associated group example member, Owner and Visitor group and add the group owner as the first parameter provided to the method call.

When I tried it some cases it worked and in some cases I was getting error “Exception calling “CreateDefaultAssociatedGroups” with “3” argument(s): “User cannot be found”

While analyzing the issue the issue I found that I am passing only first mandatory parameter as the user logon name of the group owner. Like –


And then I was getting error Exception calling “CreateDefaultAssociatedGroups” with “3” argument(s): “User cannot be found.” And the default groups are not getting added.

Further analysis concluded that the user I was passing as group owner was not getting added and hence the exception is thrown.

We have used EnsureUser before calling CreateDefaultAssociatedGroups function to make sure that before the call user should be available in user information list like –


SharePoint 2013: Item template not called in JSLink with group rendering

July 10, 2014 3 comments

Hi Friends,

I have explained the Group rendering with JSLink in one my previous blog. I will explain a common problem and a solution for that while group rendering with JSLink.


While rendering grouping in view with JSLink, We normally face an issue that item rendering handler ‘overrideCtx.Templates.Item’ is not getting called. Group rendering was working fine in my case but not item level rendering.


Initially I thought something wrong with JSLink file but after analysing and debugging I found the problem is with the grouping configured in data view.

To fix this issue edit your data view and go to grouping section of the view. Change ‘By default, show groupings’ setting to ‘Expanded’ and save the view and bingo it will start working.

Following image shows the setting in data view –

JSLink Group

JSLink Group

If you are provisioning data view declaratively then you need to add Collapse=”FALSE” to your <GroupBy node.


Possible reason for this problem is, while the groups shown in collapsed state item in that group are not loaded initially and once you click to expand the group it will be loaded on demand hence item template not gets called initially as items not loaded.

Hope this will help some of the developer looking for same kind of answer.

Happy coding!!!

SharePoint 2013: How to change the group rendering in JSLink

November 1, 2013 13 comments

Hi Friends,

It was very painful to change the list view web parts UI using XSLT changes in MOSS and SP2010. A new exciting client side rendering (CSR) feature provided in SharePoint 2013. We have seen it is pretty good and easy to implement in Content Search web part with display templates. Another addition is for list view rendering and it is called as JS link. Using JS link we can change the list view rendering with a JavaScript file easily. It will also help to debug the list view rendering from client side and easy to develop JavaScript than XSLT.

Scenario:  If we added a grouping condition in list view and we want to change the default rendering of grouping.A requirement to change the rendering of the group in JSLink.I tried multiple options and not able to found any help related to group rendering. After debugging in developer tool I found a way.

Override group template using following line of JS code-

overrideCtx.Templates.Group = CustomGroup;

Add following function which will change the group rendering-

function CustomGroup(ctx, group, groupId, listItem, listSchema, level, expand) {

var html = '<div style="font-weight:bold">' + listItem[group] + ' :: </div>';

return html;


Hope this will help some of the developer looking for same kind of answer.

Happy coding….