Nu importa useri disabled

Syncronization Connections, Edit Connection Filters, Exclusion Filter for Users, All apply (AND), attribute=userAccountControl – Bit on equals = 2, Add

Anunțuri

Copy item cu REST

function getListItem(webUrl, listName,listItemId, complete, failure) {
$.ajax({
url: webUrl + "/_api/web/lists/getbytitle('" + listName + "')/items(" + listItemId + ")",
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
complete(data.d);
},
error: function (data) {
failure(data);
}
});
}

function createListItem(webUrl,listName, itemProperties, complete, failure)
{
$.ajax({
url: webUrl + "/_api/web/lists/getbytitle('" + listName + "')/items",
type: "POST",
processData: false,
contentType: "application/json;odata=verbose",
data: JSON.stringify(itemProperties),
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function (data) {
complete(data.d);
},
error: function (data) {
failure(data.responseJSON.error);
}
});
}

function copyListItem(webUrl,sourceListName,targetListName,listItemId,complete,failure)
{
getListItem(webUrl,sourceListName,listItemId,
function(sourceItem){
//prepare item
var copyItem = {};
for (var propertyName in sourceItem) {
if (sourceItem.hasOwnProperty(propertyName)) {
if(sourceItem[propertyName] != null && sourceItem[propertyName].hasOwnProperty('__deferred')) //exclude deffered objects
{
continue;
}
if(propertyName == 'GUID' || propertyName == 'ID' || propertyName == 'Id')
{
continue;
}
if(propertyName == '__metadata') {
var targetItemType = GetItemTypeForListName(targetListName);
copyItem['__metadata'] = { 'type': targetItemType };
}
else {
copyItem[propertyName] = sourceItem[propertyName];
}
}
}

createListItem(webUrl,targetListName,copyItem,function(targetItem){
complete(sourceItem,targetItem);
},failure);
},
failure);
}

function GetItemTypeForListName(name) {
var itemType = "SP.Data." + name.charAt(0).toUpperCase() + name.slice(1) + "ListItem";
var encItemType = itemType.replace(' ','_x0020_');
return encItemType;
}

copy task item

var sourceListName = 'Tasks';
var sourceListItemId = 7;
var targetListName = 'Archive Tasks';
copyListItem(_spPageContextInfo.webAbsoluteUrl,sourceListName,targetListName,sourceListItemId,printInfo,logError);

function printInfo(sourceItem,targetItem)
{
console.log(String.format('List Item has been copied from {0} to {1}',sourceListName,targetListName));
}

function logError(sender,args)
{
console.log(args.get_message());
}

Ptr campuri explicite

function copyListItem(webUrl,sourceListName,targetListName,listItemId,complete,failure)
{
getListItem(webUrl,sourceListName,listItemId,
function(sourceItem){
//prepare item
var copyItem = {};
var targetItemType = GetItemTypeForListName(targetListName);
copyItem['__metadata'] = { 'type': targetItemType }; //mandatory, do not remove metadata attribute!

//specify explicitly what fields to copy here..
//...
copyItem['Title'] = sourceItem['Title']; //e.g. copy title

createListItem(webUrl,targetListName,copyItem,function(targetItem){
complete(sourceItem,targetItem);
},failure);
},
failure);
}

My incomplete tasks app

My incomplete tasks app is a simple app that renders your incompleted tasks from all site collections (even from SharePoint Add-ins). It’s using SharePoint Search API and in order for it to work correctly you will need to complete some configuration steps.

If you installed this app on-premise you need to complete the following configuration steps:

  1. Navigate to your Central administration, Manage Service Applications
  2. Go to your Search Service Service Application and click Manage Search Schema
  3. Click the New Managed Property link
  4. Name the new property DueDate, and make it of Text type
  5. Check the boxes for Queryable, Searchable, Retrievable and Sortable (active)
  6. Then click the Add a Mapping button, search for ows_DueDate and select the ows_DueDate property
  7. Click on the OK button to save the new property

If you installed this app in Office 365 you need to complete the following configuration steps:

  1. Navigate to your Office 365 admin center
  2. Then go to SharePoint admin center, Search administration and click Manage Search Schema
  3. Click the New Managed Property link
  4. Name the new property DueDate, and make it of Text type since we are use it just for display.
  5. Check the boxes for Queryable, Searchable, Retrievable and Sortable (active)
  6. Then click the Add a Mapping button, search for DueDate and select the ows_DueDate property
  7. Click on the OK button to save the new property

Follow the same steps for a new managed Property called PercentComplete mapped to ows_PercentComplete.

Be aware that if ows_DueDate crawled property does’t appear in the list you need to create an item in a task list with dates in Start Date and Due Date and wait for a crawl in SPO or do a full crawl in an on prem SharePoint.

After you have completed the steps listed above you will need to do a full crawl for the changes to take effect.

If you installed this app in Office 365 you will either have to create a ticket to request a full crawl, or wait up to a week.

Javascript ptr mai multe promoted links

In aceeasi pagina un script editor cu

http://code.jquery.com/jquery-1.10.2.min.js

$(document).ready(function () {
var currentRow = 1
$('.ms-promlink-root').each(function () {
if ($(this).html() != "") {
var numberOfLinksPerRow = 4;
// local variables
var pre = "

";
var numberOfLinksInCurrentRow = numberOfLinksPerRow;
// find the number of promoted links we're displaying
var numberOfPromotedLinks = $(this).find('.ms-promlink-body > .ms-tileview-tile-root').length;
// if we have more links then we want in a row, let's continue
if (numberOfPromotedLinks > numberOfLinksPerRow) {
// we don't need the header anymore, no cycling through links
$(this).find('.ms-promlink-header').empty();
// let's iterate through all the links after the maximum displayed link
for (i = numberOfLinksPerRow + 1; i tbody:last').append(pre + currentRow + post);
// reset the number of links for the current row
numberOfLinksInCurrentRow = 0
} // move the Nth (numberOfLinksPerRow + 1) div to the current table row
$(this).find('.ms-promlink-body > .ms-tileview-tile-root:nth-child(' + (numberOfLinksPerRow + 1) + ')').appendTo($('#promlink_row_' + currentRow));
// increment the number of links in the current row
numberOfLinksInCurrentRow++;
}
}
}
});
});

Get manager ptr userul curent din javascipt

//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js

$(document).ready(function () {
var userid = _spPageContextInfo.userId;
function GetCurrentUser() {
//var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + ")";
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties/";

var requestHeaders = { "accept" : "application/json;odata=verbose" };
$.ajax({
url : requestUri,
contentType : "application/json;odata=verbose",
headers : requestHeaders,
success : onSuccess,
error : onError
});
}
function onSuccess(data, request){
//var loginName = data.d.Title;
console.log(data);
var loginName = data.d.DisplayName;
var myManager = data.d.UserProfileProperties.results[15].Value;

//Use the following code to find Manager if results[15] is not Manager in future SharePoint
//var myManager = '';
//var x = data.d.UserProfileProperties.results;
//for (var i = 0; i < x.length; i++) {
// if (x[i].Key == 'Manager') {
// myManager = x[i].Value;
// break;
// }
//}

SetUserFieldValue("Employee Name",loginName);
SetUserFieldValue("Approval Manager",myManager);

}
function onError(error) {
//alert(error);
}
function SetUserFieldValue(fieldName, userName) {
var _PeoplePicker = $("div[title='" + fieldName + "']");
var _PeoplePickerTopId = _PeoplePicker.attr('id');
var _PeoplePickerEditer = $("input[title='" + fieldName + "']");
_PeoplePickerEditer.val(userName);
var _PeoplePickerOject = SPClientPeoplePicker.SPClientPeoplePickerDict[_PeoplePickerTopId];
_PeoplePickerOject.AddUnresolvedUserFromEditor(true);
}
GetCurrentUser();
});