Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all 7589 articles
Browse latest View live

Cannot expand site group users without administrative rights

$
0
0

I've got a problem with SharePoint Rest API.

I've got a service account with "Full control" permission level.

I need to list all group members in my site collection.

I can run:

https://mytenant.sharepoint.com/_api/web/sitegroups

It returns my groups in the site collection, but does not have their group memberships which I need.

So I try the following, but I get blocked trying:

https://mytenant.sharepoint.com/_api/web/sitegroups?$expand=Users
"value""Access denied. You do not have permission to perform this action or access this resource."


I am, however, able to get the members of each group individually. Example:

https://mytenant.sharepoint.com/_api/Web/SiteGroups/GetById(6)/Users
Is this an oversight on Microsoft's side? I cannot list all groups and their members without being an administrator?

This is now going to force me to do NumGroups extra API requests on SharePoint which isvery costly for me in terms of rate limiting.


SharePoint Event Receiver Environment.CurrentDirectory after deployment

$
0
0

Hello,

I have developed an event receiver which will create a pdf file upon list submit record and drop the file at Environment.CurrentDirectory

When I run in the development, I see that the file is at C:\Windows\System32\inetsrv  but when I deployed the event receiver in production which is NLB 2 web front end server but I am not able to find where the file is dropped/generated. I checked the system files, folder from where I deployed the event receiver, I checked the _layout folder on both wfe servers but unfortunately I cant find the file at all. Is there a way to verify where these event receiver will generate a default current directory location? Please advise.

Thanks

Shri

Splitting the Top Link Bar in two rows

$
0
0

Hi,

Does anyone know how I can modify the Top Link Bar to display the links in two rows instead of one? We have many subsites, and the Top Link Bar keeps extending the row horizontally instead of wrapping it, meaning that we will always have a horizontal scroll bar and that we can't see the search field without scrolling. Which is very annoying.

Does anyone know how to modify it? We're on Sharepoint 2013.

Any help will be much appreciated. Thanks!

SharePoint 2013 List - Drag n drop attachments without datasheet view

$
0
0

SharePoint 2013 List on premises

Can we drag n drop files - Attach files in a sharepoint 2013 list not in datasheet view?  All items

Thank you!

Below is a js file with datasheet view drag n drop

/***** ITEM DRAG AND DROP *****/
/*** Uploads a document after the user drags and drops it over an item. *****/
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
            OnPostRender: [
                function (ctx) {
                    DragNDropItem.userName = jQuery("#welcomeMenuBox a.ms-core-menu-root").text().replace("Use SHIFT+ENTER to open the menu (new window).", "");
                    DragNDropItem.confirmMSG = "Uploading of High-Risk Personally Identifiable Information (PII) is prohibited.  If you are unsure about what constitues High-Risk PII, please see PII Guidance on the  Home Page" + "I, "+DragNDropItem.userName+" am affirming I am compliant with PII Guidance and understand the implications of uploading any and all material"
                    var checkExists = setInterval(function () {
                        if (jQuery("div[id*='spgridcontainer']").length > 0 && jQuery("[id*='_leftpane_mainTable']").length > 0) {
                            clearInterval(checkExists);
                            ItemDragNDrop()
                        }
                    }, 100)
                }
            ]
        });
function ItemDragNDrop(){ //adds the drag and drop to the table rows
var launchDragNDrop = false;

for(i in g_ctxDict){
    var wpq = g_ctxDict[i].wpq
jQuery("#spgridcontainer_"+wpq+"_leftpane_mainTable tr[iid]").each(function(i){ //changed to iid attribute
    jQuery(this).addClass("dropContainer")            
});  
}
//appending the file input to the body and hiding it.
if(jQuery("#itemDragNDropFileInput").length == 0){
jQuery("body").append('<input type="file" id="itemDragNDropFileInput">')
jQuery("#itemDragNDropFileInput").css("display","none")
}
jQuery("body")[0].ondragover = jQuery("body")[0].ondragenter = function(evt) {
  evt.preventDefault();
};
jQuery('body').append("<div id='uploadToolTip' style='font-size:26px;'></div>")



jQuery(".dropContainer").on({
drop: function(evt){
jQuery("body").append('<div id="PIITicketSpinner">Spinner</div>')
var e = document.getElementById('PIITicketSpinner');
var uploading = {
title: "Uploading Document(s) to "+DragNDropItem.Title,
showClose: false,
width: 450,
height: 200,
html: e.cloneNode(true)
};
evt.preventDefault();  
evt.stopPropagation();
jQuery(".dropContainer").css('border','none').css('background','none')
jQuery('#uploadToolTip').offset({"white-space:pre;">DragNDropItem.folderDragNDropCtx = getCtx("WebPart"+DragNDropItem.WPQ)
var folderDragNDropCtxNum = DragNDropItem.folderDragNDropCtx.ctxId
var ListTitle = DragNDropItem.folderDragNDropCtx.ListTitle
var js = document.getElementById(DragNDropItem.closestWPQ).jsgrid
var itemName = js.GetRecord(DragNDropItem.ID).fieldRawDataMap.csrInfo.Title
DragNDropItem.numOfItems = evt.originalEvent.dataTransfer.files.length
DragNDropItem.files = evt.originalEvent.dataTransfer.files

if(confirm(DragNDropItem.confirmMSG)){        
for(var i=0;i<DragNDropItem.numOfItems;i++){
DragNDropItem.attachFile(evt.originalEvent.dataTransfer.files[i])
}
}
//for loop to call DragNDropItem.attachFile 
//loop DragNDropItem.numOfItems of times and pass DragNDropItem.files
},
dragover: function(e) {
var newID = jQuery(this).attr("iid").split(",")[1] //gets the item ID

//run if the coordinates are not the same. Adds the tooltip
if(DragNDropItem.DragNDropX !== e.originalEvent.pageX && DragNDropItem.DragNDropX !== e.originalEvent.pageX){
DragNDropItem.DragNDropX = e.originalEvent.pageX
DragNDropItem.DragNDropY = e.originalEvent.pageY
DragNDropItem.Title = jQuery(this).attr("title")
jQuery('#uploadToolTip').offset({Upload to: "+DragNDropItem.Title)

}
//changes the background color of the table row when hovering
    e.preventDefault();      
    e.stopPropagation();
    jQuery(this).css('border','3px solid #3d7ee0').css('background','rgb(156, 206, 240)')     
    DragNDropItem.ID = jQuery(this).attr("iid").split(",")[1] //getting the item ID
    DragNDropItem.closestWPQ = jQuery(this).closest("div[id^='spgridcontainer']")[0].id
    DragNDropItem.closestWPQ = DragNDropItem.closestWPQ.replace("_leftpane","") //getting
DragNDropItem.WPQ = DragNDropItem.closestWPQ.replace("spgridcontainer_","")

},
dragleave: function(e) {
    e.preventDefault();  
    e.stopPropagation();
    jQuery(this).css('border','none').css('background','none')
    jQuery('#uploadToolTip').offset({"white-space:pre;">}
});


}
var DragNDropItem = {
    ID:"",
    closestWPQ: "",
numOfItems: 0,
MaxAttemptNumber: 2,
UploadModal:{},
internalName:"",
folderDragNDropCtx:"",
DragNDropX:0,
DragNDropY:0,
Title:"",
    
    attachFile: function(file) {
var getFileBuffer = function(file) {
var deferred = jQuery.Deferred();
var reader = new FileReader();

reader.onload = function(e) {
deferred.resolve(e.target.result);
}

  reader.onerror = function(e) {
deferred.reject(e.target.error);
  }

  reader.readAsArrayBuffer(file);

  return deferred.promise();
};

getFileBuffer(file).then(function(buffer) {
var bytes = new Uint8Array(buffer);
var content = new SP.Base64EncodedByteArray(); //base64 encoding
for (var b = 0; b < bytes.length; b++) {
content.append(bytes[b]);
}
jQuery().SPServices({
operation: "AddAttachment",
listName: "Datasheet", //fix
listItemID: DragNDropItem.ID,
fileName: file.name,
attachment: content.toBase64String(),
completefunc: function(data,status){
if(status == "success"){

}else{


}
}
});
})
    }        
    
};


/**** END ITEM DRAG AND DROP ***/

SharePoint 2013 List Header show all columns

$
0
0

hi

Below is the script don't seems to work when I scroll to the right.  The Stickyheader.js I found on the internet doesn't refresh the page normal.  I had to scroll back to the left when the page fresh.

<style type="text/css">
#LZheading {
    HEIGHT: 36px;
    display:none;
}
.FixedHeader{
    margin-top: -220px; 
    ;
    border-color: black !important;
    background-color:white;
    color:black !important;
    font-weight: bold !important;
    display:block !important
}
#LZheading>table>tbody{
    visibility:hidden;
}
</style>
<script type="text/javascript">
window.onload = function() {
    LZListScroll();
    document.getElementById("s4-workspace").onscroll=function(){
        var LZHead=document.getElementById("LZheading");
        if(this.scrollTop > 200){
            LZHead.classList.add("FixedHeader");             
        }else{
            LZHead.classList.remove("FixedHeader");         
        }
    }
};
function LZListScroll() {
    var LZmyTable=document.getElementsByClassName("ms-listviewtable")[0];
    var insertDiv=  document.getElementsByClassName("ms-csrlistview-controldiv")[0];    
    var LZHeadingDiv = document.createElement('div');
    LZHeadingDiv.appendChild(LZmyTable.cloneNode(true));
    LZHeadingDiv.id = "LZheading";
    insertDiv.parentNode.insertBefore(LZHeadingDiv,insertDiv.nextSibling);
}
</script>

How can I open the /_layouts/15/aclinv.aspx and set it to a default group

$
0
0

I have several issues:

1) I am opening the add the user to a group page (aclinx.aspx) in a Modal Dialog form from another Modal dialog. Although I am passing the MembergroupID, when the Modal dialog opens it asks the user to select a group from which to add the user to. This is confusing for the user. Is there a way to pass a parameter to the aclinx.aspx so that the group to add the user to is set? 

/_layouts/15/aclinv.aspx?MembershipGroupId=569

2) I tried to use the 

/_layouts/15/people.aspx?MembershipGroupId=569 instead. However, when I close the People.aspx Modal dialog, it opens the parent page in a Modal dialog and I don't know how to close.

The solution that works is below (if you can assist);

From the first Modal dialog open the /_layouts/15/people.aspx?MembershipGroupId=569, add a user and then after returning to the first Modal dialog not to open the parent page in modal dialog.

Any idea how I can accomplish that?


faye fouladi

Why does SharePoint put in character code 8203 in a richtext field?

$
0
0
I use some RichHtmlField controls (PublishingWebControls) in different pagelayouts. I edit the pages, put some text in the fields and publish. It all seems to work fine, but I've noticed that SharePoint saves an extra character to my string. Usually it's added at the beginning of the string, but sometimes at the end.

You cannot see it using the ordinary browser window, because it's a zero width space character. But if you right click and select View source, it's visible as a big space. 

It's possible to copy the text from the view source window to a text editor preserving this character, so I pasted it as a string in a c# program. When I loop through every character in the string to check its ascii value, this particular character shows as 8203.

I used CAML Builder to check what my string looked like in the database. I couln't see anything strange, but when I copied the string from the CAML Builder result tab and pasted it into a hex editor, you could clearly see that the strange character was there.

The problem is that we translate our pages to different languages and this character makes the translation engine go bananas.

Has anyone experienced this before or has any idea how this could be solved?

Get user properties by specific Id

$
0
0

How I can use to get user properties (login name, display name and\or title) from a specific user id ?

I have tried this but no luck:

var user = context.get_web().siteUsers().getById(userID);

Thanks for any help.


Color Coding SharePoint List Item Columns Based on Today's Date

$
0
0

I have a SharePoint Online list where I have been able to format the background color of the cells in the column based on the text in the field using this formula:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "padding-left": "14px"
  },
  "attributes": {
    "class": "=if(@currentField == 'Apr-2020', 'ms-bgColor-blueLight', '') + ' ms-fontColor-black'"
  }
}

It looks like this:

What I would like to have happen is for the Jan-2020 entries to be automatically made darker because January 2020 is now in the past (based on today's date).  How can I modify the formula so that when months are in the past that the color for that column automatically makes the color darker?  It would also be nice to have the formula changed so that instead of it looking for a specific value, that if there is any value the colors are applied.

Thanks for your help!

REST API Get all documents Error Exceeds the list view threshold

$
0
0

Hi all,

I want to call one API to get all folder, and one API to get all documents.

- Get Folder

https://ebrevia.sharepoint.com/_api/web/lists(guid'6a73ca9d-b244-4022-bdd6-679d537d97a6')/items?$filter=ContentType eq 'Folder'&$top=100

- Get Documents

https://ebrevia.sharepoint.com/_api/web/lists(guid'6a73ca9d-b244-4022-bdd6-679d537d97a6')/items?$filter=ContentType eq 'Document'&$top=100

when I test on Postman.And it occur error 

The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator


I search google about this error, and recommend is manually add Column index ContentType

When I test again Postman, result is API Get Folder work work, but API get Documents still occur errorexceeds the list view threshold.

Have anyone met this error. Please give me a hand.

- Add Index ContentType

- Success with get all folder

- Error with get Documents

Thank a lot,

Danh



Reply to a topic in Discussion board List using CSOM

$
0
0

I am working with a Discussion board list. I need to create the whole list using CSOM from scratch. To which I was able to make the list and topic inside it as folders. But I am not able to add replies to those topics. If I add replies as ListItem it shows as Topic inside the topic.

I wanted to know how to add replies to topics and also how to add replies to replies.

Update taxonmy field value with Rest API

$
0
0

Hi Experts,

Can we update taxonmy field value with Rest API ? I can't find a working demo, could you please help to provide ?

Thanks for any help.

Unhide Order column for list

$
0
0

Hi All,

I am trying to unhide the "Order" column for SharePoint list(SPO 2013), tried doing below script but it keeps giving me error :

Exception setting "Order": "The property 'Order' cannot be found on this object. Verify that the property exists and can be set."

$siteUrl = "https://mysite.sharepoint.com/sites/Test"; # YOUR SITE URL

Connect-PnPOnline -Url $siteUrl  -UseWebLogin

$listName="JinivTest"
$fieldName="Order"
$formula="FALSE"

$field = Get-PnPField -List $listName -Identity $fieldName 
[xml]$schemaXml=$field.SchemaXml
$schemaXml.Field.Order=$formula
Set-PnPField -List $listName -Identity $fieldName -Values @{SchemaXml=$schemaXml.OuterXml}

Reference : https://www.eliostruyf.com/order-list-items-like-in-a-meeting-workspace-part-1/

https://sharepoint.stackexchange.com/questions/192112/order-column-in-sharepoint-2013-list-document-library

Please guide.


Thanks in Advance, Jiniv Thakkar

How to return more Permission data in response of API get all list documents or all list folder.

$
0
0

Hi all,

I have one problem about Permission Docs or Folder for current user that logged in SharePoint site. Please help me if you met issue before.

How to return more Permission data  in response of API get all list documents or all list folder.

API get all documents that I use:

https://ebrevia.sharepoint.com/_api/web/lists(guid'45d2a20f-9d97-4acd-88bf-0b1ad3db1a6a')/items?$select=UniqueId, GUID,Id,FileLeafRef,FileRef&$filter=ContentType eq 'Document'

Thanks,

Danh



I am not able to get the selected values from a multiselect dropdown on a NewForm.aspx

$
0
0

Below is my code:

It is not working. I need to get the first value selected.

<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script type="text/javascript">
        $(function () {
            //MultiLookup is filed title
            var values = $('select[title="Lead Subject Area selected values"]').children('option').map(function (i, e) {
                return e.value || e.innerText;
            }).get();
            alert(values);
        })
    </script>

thanks


faye fouladi


setting the custom master page through powershell is NOT working

$
0
0

Hi,

 I am writing the below code to set the  custom master page through powershell.

But its not working .when i went to site settings-->master page --> in the drodown , the  maste page set is seattle.master ONLY, though my current master page is available in the dropdown.

 Can anyone pls help, whether i am missing in the below :

      Add-PSSnapin Microsoft.SharePoint.Powershell
       $SiteURL = "http://srvr1:22307/sites/SPW5"
    $weburl= $SiteURL
    $Site= Get-SPSite $SiteURL
    $web =  $Site.OpenWeb()

$web.CustomMasterUrl = "/_catalogs/masterpage/myMasterpage.master"
$web.MasterUrl = "/_catalogs/masterpage/myMasterpage.master"
$web.Update()
   


Das



Adding custom coloum in Reorder.aspx page

$
0
0

Hi All,

I am using Reorder.aspx for my custom list, I want to show my custom column instead of "Name". I know this Reorder.aspx is an application page but is there still a way to achieve my requirment ?

Reorder.aspx


Thanks in Advance, Jiniv Thakkar

SharePoint Rest API get wrong date

$
0
0

I'm using SharePoint Rest API to get a date column, however, it's return the incorrect date value, a few hours less than the real date time.

Could anyone please tell me what's the reason ?

Thanks in advance.

overlay option missing in ribbon

$
0
0

HI,

I have  created different calender views on sharepoint 2016 on Prem,in ribbon calender overlay feature is missing in ribbon.

How can I make it visible calander overlay in ribbon.

Thanks

Custom functionality like Reorder.aspx

$
0
0

Hi All,

I want to have custom functionality like Reorder.aspx. When the order of a list box item is changed, it should automatically take care of the values of remaining list box.

Can this be done using Jquery or any custom coding.

We cannot use Reorder.aspx as we have a list of countries and cities and each city needs to be reordered.

List Schema 

Countries

Cities

Sequence Using Reorder.aspx

Sequence I want using Reorder.aspx

USA

New York

1

1

USA

LA

2

2

USA

Chicago

3

3

USA

Houston

4

4

India

Pune

5

1

India

Mumbai

6

2

India

Solapur

7

3


Please help.


Thanks in Advance, Jiniv Thakkar

Viewing all 7589 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>