New answers tagged

1

Can you try changing this line from: getAssignedToUserIdByEmail(users[0].EntityData.Email); to getAssignedToUserIdByEmail(users[i].EntityData.Email); It looks like it is hardcoded to pass in the first element instead of using i to resolve each user in the loop.


2

You can get the User details using user Login Name by using REST API URL like below: https://<site url>/_api/web/siteusers(@v)?@v='<login name>' Where you have to replace the user's login name. As you have user's email address you can construct (hard codes) the login name using email address. And for that you just need the format of login ...


1

See the updated sample code as below: If you have single selection for User and Group field and for Choice field then create data as given below function createEmployeeDetailsListItem(excelRow) { var data = { __metadata: { type: "SP.Data.E2EVMVulnerabilitiesMappingMasterListItem" }, Title: excelRow["Title"], ID: excelRow["ID"], ...


1

You can read excel in jquery and after that you can store that data into SharePoint using rest api or client context, using client context you can store data in bulk. Read excel using jQuery: <script src="jquery-1.10.2.min.js" type="text/javascript"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.7.7/xlsx.core.min.js">...


1

You've got a lot of code here but the only code that's relevant to the question is the first four lines of the first function. The code looks correct on first glance but the devil is in the details. I think your errors are most likely to be an incorrect jQuery selector or a people field that's not configured as you expect. Or maybe your SPClientPeoplePicker ...


0

We can use CAML query with REST API to group by list items. Example code: <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { var listName="TestList"; var fieldName="LookupField"; var viewXml ="<View><Query><GroupBy Collapse='...


1

Looks like you have set the isDomainIsolated property to true in the package-solution.json file. Modify the value to false and then do the process again to package the webpart and re-upload it in the app catalog site collection. Should work now in the SharePoint pages.


0

First of all CAML is used in REST URL to bifurcate the limitation of REST URL (endpoint) of 260 characters in GET call. Please refer below URL to understand the limitations of REST and workarounds for those, https://www.c-sharpcorner.com/blogs/sharepoint-rest-api-limitation Also, when used CAML in REST GET/POST call, we dont directly include query in URL ...


2

Instead of using "GetPropertiesFor" use "GetUserProfilePropertyFor". Use following url: https://site_url/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Manager')?@v=%27i%3A0%23.f%7Cmembership%7COmi%40company.com%27


0

Just a bit more information, CSOM also works for such situation. #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"...


0

Using REST from C# or just about anything... URL: https://yourDomain/sites/yourSite/_api/web/lists Header: {"accept": "application/json;odata=verbose", "content-type": "application/json;odata=verbose", "content-length":__len__, "X-RequestDigest": "__yourRequestDigest__"} Body: {"__metadata": { "...


1

Any of the above. If you're accustomed to powershell, an easy way is to get the PNP PowerShell modules installed, which is a helper library where others have written the CSOM code for you. Once you have it installed, here's the code to create a new list: New-PnPList -Title "Demo List" -Url "DemoList" -Template Announcements The docs are here, make sure ...


0

SharePoint Online - check if a User is in a group with jSOM for your reference: https://www.c-sharpcorner.com/blogs/sharepoint-online-check-if-a-user-is-in-a-group-with-jsom


0

Try below code. It should work. I have modified your code little bit. I suspect you are not using SharePoint Master Page in your custom form. So you will not get request digest vakue directly through $("#__REQUESTDIGEST").val() as it is available only in SharePoint Master Pages. So You will have to get it first by POST call to "_api/contextinfo" $(...


1

The following code for your reference. <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { var listTitle="Activos del sitio"; listTitle=encodeURIComponent(listTitle); $.ajax({ url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle(...


1

You can use the List GUID in the REST API. Go to Library Settings and in the URL you will fin the GUID as shown in image below. Remove the "%7B" from the start and "%7D" from the end and use it in the rest api as shown in example below (replace the GUID with your GUID). https://spdev.sharepoint.com/sites/SPTeam/spanish/_api/web/lists('85851fae-11b4-4c3f-...


1

Most likely, you receive the fileContent as base64 string from the external service. So first, you must convert it into a stream and then post the stream in the body: spClient.DefaultRequestHeaders.Add("Accept", "application/json;odata=verbose"); foreach (var file in data["files"]) { var bytes = Convert.FromBase64String(file["File"]["fileContent"]); ...


1

Are you able to access the _spPageContextInfo.webAbsoluteUrl ? As per this post _spPageContextInfo does not work in the Modern site of SharePoint Online. You can use the approach mentioned in the mentioned link to get the site URL.


0

can you please change the actual rest query to get the value of all the groups current user is associated to as below in bold text function isCurrentUserMemberOfGroup(groupName) { var isUserInGroup = false; $.ajax({ async: false, headers: { "accept": "application/json; odata=verbose" }, method: "GET", url: ...


0

Make sure the content of the body use a single quote. Example: { '__metadata': { 'type': 'SP.Data.SampleListItem' }, 'Title': '~actual content~' } Try to use replace(~actual content~,'''','\''') to pass the redefined data. By using the above code all the single quotes will be replaced with double single quotes, and the data will be parsed with ...


0

You can get the Sample code for CRUD operations on SharePoint using below link: GitHub - SharePoint CRUD operations. Also, you check below articles for step by step guide: CRUD operations using SharePoint Framework webpart and PnPJS: SharePoint-Framework-Development-Create-List-CRUD-WebPart-PnPJS. CRUD Operations Using Sharepoint FrameWork And PnP JS ...


1

Try using below code: url: `${this.props.siteurl}/_api/web/lists/getbytitle('Templates')/items?$select=Title,CurrentLink,HistoricalLink,DataGroupTemplate/Template&$expand=DataGroupTemplate&$filter=DataGroupTemplate/Template eq '${a}'` Update: Instead of ${this.props.siteurl}, try using ${reactHandler.props.siteurl}.


0

I am afraid that there is no Update method to update the managed metadata term store programmatically. We can create group and get group, termsets and terms programmatically. More references: TermStore members. O365 - Programmatically Create New Term Store Management In SharePoint Online – CSOM.


1

Try Using below SharePoint REST API Code: function isCurrentUserMemberOfGroup(groupName) { var isUserInGroup = false; $.ajax({ async: false, headers: { "accept": "application/json; odata=verbose" }, method: "GET", url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/currentuser/groups", success: function (data) ...


0

If its an external application I think you need to register it in Azure AD This question may help: SharePoint Online REST API Authentication When you have registered your app you will be able to use the access token to authenticate SharePoint requests in your application


2

You can use below to get file versions history, there is rest endpoint available which will give you all version of a file using item id, also it can be done using JSOM. REST API /sites/yoursite/_api/Web/Lists(@v0)/Items(@v1)/Versions?&@v0=guid'112313-13cebe-1233-822e-asd123123123'&@v1=10 JSOM (ref link) var oItems, clientContext, oFile, ...


0

You can use JShare from here : JShare API It supports Microsoft SharePoint server 2013 and SharePoint Online / Office 365


0

After creation of your lookup field you can call another rest api as shown below to add the dependent (additional) fields. $.ajax({ url: "http://<site url>/_api/web/lists(guid'da58632f-faf0-4a78-8219-99c307747741')/fields/adddependentlookupfield(displayname='Project', primarylookupfieldid='c3a92d97-2b77-4a25-9698-3ab54874bc6f', showfield='Title')",...


0

you can use addviewfiled in the API URI much like : _api/web/lists(guid)/views(guid)/viewfields/addviewfield('Title')


0

Why not try use filter instead /web/lists/GetByTitle('Situation')/items?$filter=ID eq 8


Top 50 recent answers are included