Tag Info

New answers tagged

0

This query will give you Author column (user) with email from a list 'Test': /_api/Web/Lists/GetByTitle('Test')/Items?$select=Author/EMail&$expand=Author/EMail You can replace 'Author' with any other Person/Group column.


1

Hi i already solve my problem below is my code: List docs = web.Lists.GetByTitle("CustomList"); ListItem item = docs.GetItemById(ID); var attInfo = new AttachmentCreationInformation(); attInfo.FileName = mFile.Name; ...


0

This can be done by calling SPservice operation AddAttachment in the csom code. Reference


0

The ASP.NET (asmx) web services, and direct Remote Procedure Calls (RPC) calls to the owssvr.dll file are deprecated, but are still supported in the SharePoint 2013 framework for backward compatibility. I think you have to use REST API. Choose the right API set in SharePoint 2013


0

Querying my work's SharePoints the response header has the SharePoint version. I don't know how many SharePoints will have that available for you to check but you could try this before the failsafe of asking the user.


1

Since List.DefaultViewUrl property is not loaded by default you have to include it explicitly as demonstrated below: var context = SP.ClientContext.get_current(); var lists = context.get_web().get_lists(); context.load(lists,"Include(Title, DefaultViewUrl)"); context.executeQueryAsync( function () { var e = lists.getEnumerator(); while ...


2

The syntax for loading Default View URL is below. context.load(lists,'Include(DefaultViewUrl)'); Default view is a valid list property and we need to explicitly load it.


1

It could be an issue with this, since it changes scope when you use it in the delegates, try using var items= list.getItems(camlQuery) as you do in your first snippet: function getItemsWithCaml(listTitle) { //use of $.Deferred in the executeQueryAsync delegate allows the consumer of this method to write 'syncronous like' code var deferred = ...


0

Try below code. $(document).ready(function () { //don't exectute any jsom until sp.js file has loaded. SP.SOD.executeFunc('sp.js', 'SP.ClientContext', prepareTables); }); function prepareTables() { for (var i = 0; i < 3; i++) { var d = getItemsWithCaml('External User Account Request'); d.done( ...


3

As part of using AddFieldAsXml you need to provide the field's internal and staticname announcementy.Fields.AddFieldAsXml("<Field Type='User' DisplayName='Created By' StaticName='CreatedBy' Name='CreatedBy'/>", true, AddFieldOptions.AddToAllContentTypes); announcementy.Fields.AddFieldAsXml("<Field Type='DateTime' DisplayName='Date Created' ...


0

Workaround Create a hidden list Break inheritance of the list Give read permission only to the SharePoint group in question Try reading from the list using JSOM If read succeeds then the current user is part of the AD group, else not Note - The above solution is not tested


0

Another option when making an async call that depends on another async call is to use jQuery.Deferred(): $(document).ready(function () { $('#SearchButton').click(function () { function getData() { var ctx = SP.ClientContext.get_current(); getFirstItem(ctx).then(function () { // d.resolve will call this function ...


0

This problem is due to the fact that SharePoint only allows out of the box REST & CSOM endpoints consumption from Apps so if you deploy custom WCF services, it won't be allowed from within the App. If you use sp.webrequestinfo cross-domain library, you'll notice that it will work providing your service is consumable anonymously but what if you have your ...


0

I would suggest that you shouldn't use the window.onload(); instead try and use this. $(document).ready(function() { // executes when HTML-Document is loaded and DOM is ready ExecuteOrDelayUntilScriptLoaded(ViewItem, "sp.js"); alert("(document).ready was called - document is ready!"); }); Hope this fixes the issue.


0

You do not need to dispose any JavaScript objects. As I understand you are probably asking this question as a part of CSOM using Javascript mostly used in SharePoint apps. I've worked on MSDN code samples and I didn't need to dispose any of the objects. As @ryan has said the garbage collector does the dirty work.


0

In order to get a context in a Windows App using CSOM, you still need to create a context. In C# with CSOM, you'd use: using Microsoft.SharePoint.Client; ClientContext cc = new ClientContext(Settings.Default.SiteName); cc.AuthenticationMode = ClientAuthenticationMode.Default; string username = Settings.Default.UserName; string password = ...


0

Either on of these lines was all I needed at the beginning of the script..... ExecuteOrDelayUntilScriptLoaded(HideWP, "sp.js"); or _spBodyOnLoadFunctionNames.push("FunctionName");


1

There is no built-in method in SharePoint CSOM API for copying Folder with Files from one location into another. The following solution demonstrates how to copy files from source folder into destination folder: public static class FolderExtensions { /// <summary> /// Copy files /// </summary> /// <param ...


-2

use this enough $.ShowProcessing("Refreshing Collections...");


2

Return the results of your first call (which will be a jQuery Deferred object) then use that object with jQuery.when() in order to force all of the first calls to complete before the second one can begin: $('.littcls').each(function() { // *** use these variables to hold all of the promises you create in the loop var addTTItemPromises = [], ...


2

As a part of the new Minimal Download Strategy (MDS) the sp.js library is not loaded until explicitly called in SharePoint 2013. Solution Use SP.SOD.executeFunc function to ensure that sp.js library is loaded and then run the specified callback function: SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function(){ //Your code goes here, for example ...


0

There is no built-in method for retrieving List by its Url, in C# CSOM the following method could be used for that purpose: public static List LoadListByUrl(ClientContext context,string listUrl) { var lists = context.LoadQuery(context.Web.Lists.Where(l => l.RootFolder.ServerRelativeUrl == listUrl)); context.ExecuteQuery(); return ...


1

Since Folder resource does not expose Content Type property I would recommend you to create Folder using SharePoint 2010 REST endpoint, in that case Content Type could be specified as demonstrated below: function createFolder(webUrl,listName,folderUrl,folderContentTypeId, success, error) { var urlParts = folderUrl.split('/'); var folderPath = ...


2

You have to specify the URL to new SP.ClientContext(url) From MSDN: var url = 'replace with server-relative or absolute URL'; var clientContext; var website; // Make sure the SharePoint script file 'sp.js' is loaded before your // code runs. SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady); // Create an instance of the client context for ...


0

SharePoint JavaScript Library contains the SP.Ribbon.NativeUtility.getCtxForView method that could be used for retrieving Context Info by View id, for example: //Retrieve Context Info by View Id var viewId = '{C441B540-C04D-4592-A526-26F57DA6914A}'; var ctxForView = SP.Ribbon.NativeUtility.getCtxForView(viewId); console.log(currentCtx); In order to ...


1

How to create Wiki page using SharePoint CSOM The example below demonstrates how to create wiki page via CSOM (VB.NET version): Sub CreateWikiPage(context As ClientContext, pageName As String, pageContent As String) Const templateRedirectionPageMarkup As String = "<%@ Page ...


0

There is no need to load RecycleBinItem collection, use RecycleBinItemCollection.GetById method to get Recycle Bin item by the specified identifier from the collection. The following example demonstrates how to find RecycleBinItem by identifier and delete it: var recycleBinItemId = new Guid("recycle bin item guid"); var recycleBinItem = ...



Top 50 recent answers are included