Article archive
Get users from item user field
01/12/2017 12:06
public static List<SPUser> GetUsersFromField(SPListItem item, string fieldName)
{
SPGroup group = null;
var users = new List<SPUser>();
...
User access to custom application page
01/12/2017 12:02
To enable set e. g. edit permissions for only folder for some specific user who is not member of any sp group, we need to deactivate site collection feature Limited-access user permission lockdown mode
Then user can access its folder and doesn't see other content. He can browse,...
Select collection subset by jQuery
29/11/2017 12:28
Use $.grep function
var selectedItems = jQuery.grep(items, function (item, index) { return item.someProperty === someValue });
Use return value from Ajax call
29/11/2017 12:19
var myFunctions =
{
checkEditRightsForFolder: function (destUrl, destWebUrl, destWebId) {
var postData = JSON.stringify({ destUrl: destUrl, destWebUrl: destWebUrl, destWebId: destWebId });
var url =...
Get User field value
13/07/2017 13:34
public static SPUser GetUserFromField(SPListItem item, string fieldName)
{
SPUser user = null;
if (item != null && !string.IsNullOrEmpty(fieldName))
{
if (TryGetFieldFromItem(item, fieldName) != null && item[fieldName] != null)
{
var userFieldValue = new...
Find if item is child of Content type
13/07/2017 13:25
public static bool IsItemChildOfContentType(SPListItem item, SPContentTypeId contentTypeId)
{
var itemCtId = item.ContentType.Id;
var isContentType =...
Convert List<string> items to string with separator
13/07/2017 13:21
public static string BuildStringFromList(List<string> list, string separator = ";")
{
string separatedValues = string.Empty;
if(list.Count > 0)
separatedValues = list.Select(a => a.ToString()).Aggregate((i, j) => i + separator +...
Get Taxonomy field value programmatically
13/07/2017 13:20
public static string GetTaxonomyFieldValues(SPListItem item, string fieldName)
{
var values = string.Empty;
if (TryGetFieldFromItem(item, fieldName) != null...
CAML Query Paging
13/07/2017 13:12
We needed to use paging in CAML query and this scenario is not supported, to query list with specific query and get e. g. third page of results.
I created two specific queries to list, one to get items count (query without rowlimit) and other empty query with rowlimit to return only appropriate...
Copy generic list without references
28/07/2016 10:04
Sometimes we need to make new generic list based on another list - by query or other. But when we change list2 properties, list1 is also changed. That's why we need to make list1 copy without references. Here is the code to create the copyAdd following code to ListExtensions.cs file public...
Items: 21 - 30 of 384