Tag Info

Hot answers tagged

8

You cannot make cross-sitecollection calls from javascript client object model in SharePoint 2010. But you can make such calls in SharePoint 2013: var crossSiteContext = new SP.ClientContext("http://url-of-another-siteCollection/"); var crossSiteWeb = crossSiteContext.get_web(); crossSiteContext.load(crossSiteWeb); ...


2

With External lists the BDC Identity IS what you want you want in lieu of the traditional list item ID. This is actually in an MSDN reference that I am failing to find to provide a link too. I was still dealing with the problem of each BDC Identity being duplicates - which is why the getSelectedItems was not working. We resolved this by correcting the ...


2

About the first one: since it is a note field, I suppose that that is the actual content of the field. SharePoint automagically formatted your text when you inserted it into the list. About the second one. Again, expected. The user will be returned as an instance of the FieldUserValue class. Cast it to read the actual info. For example: //Note: will give ...


2

Use AppCatalog class for this. Proof of concept below: class StackExchangeProof { static void Main(string[] args) { var login = "admin@yourdomain.onmicrosoft.com"; var password = "YourHardP@ssw0rd"; var url = "https://yourdomain.sharepoint.com"; var creds = new SharePointOnlineCredentials(login, ...


1

Getting items from a list using SharePoint JavaScript client object model: var siteUrl = '/sites/MySiteCollection'; function retrieveListItems() { var clientContext = new SP.ClientContext(siteUrl); var oList = clientContext.get_web().get_lists().getByTitle('Announcements'); var camlQuery = new SP.CamlQuery(); ...


1

For the user you need to get the LookupValue property and then use toString(). objFieldUserValue.LookupValue.ToString(); Microsoft.SharePoint.Client.FieldUserValue Title For the NoteField try to get the property Text. NoteField properties


1

Now that you have explained your issue better and I see your question actually has nothing to do with getting the title and URL, I can make a suggestion. Load the web properties in a batch. Then use a single execute query after the while. Anonymous functions embedded just to keep lines of code down. var ctx = SP.ClientContext.get_current(); var ...


1

In order to get value from Web.AllProperties property (PropertyValues type) you could use the following ways: FieldValues property Item property Example: get Web AllProperties var context = new SP.ClientContext.get_current(); var web = context.get_web(); var props = web.get_allProperties(); context.load(props); ...


1

Using non-Public methods is never "supported" by the SharePoint Product Group (for example, a PowerShell script that reads a value from a private property). While I'd be more comfortable running a PowerShell script to read non-public properties, doing so in a product (be it internal or external) is not something I would do as I could not get Microsoft ...


1

[Applies to SP 2010] You need to make sure that the SP.js file is loaded before executing the function. Taken from the MSDN: SP.SOD.execute Executes the specified function in the specified file with the optional arguments. SP.SOD.executeOrDelayUntilScriptLoaded Executes the specified function after the file specified has been loaded; ...


1

If this is an app or anything outside of a SharePoint page you need to load document.write('<script src="' + spHostUrl + '/_layouts/15/MicrosoftAjax.js"><\/script>') document.write('<script src="' + spHostUrl + '/_layouts/15/sp.runtime.js"><\/script>') document.write('<script src="' + spHostUrl + ...


1

Since it an ItemUpdated it is calling the same code again and again. In Server object model we have this.EventFiringEnabled = false; to prevent the event from firing again. You may have to perform some checks to avoid the update operation recurrence. Here is a somewhat similar question: Remote Event Receiver on updated will be fired multiple time


1

Choice JS or Server OM depends on you. For example if you think that in the future you will need the same code in SP Online, in that case is better write the code in JS. The main object for that is PeopleManager. This is an example of JS code: var personProperties; // Ensure that the SP.UserProfiles.js file is loaded before the custom code runs. ...


1

You need to call context.executeQueryAsync And then try to get the item count in the success method. UPDATE You are not specifying the query in SP.List.getItems(query_); Example: var clientContext = new SP.ClientContext(siteUrl); var oWebsite = clientContext.get_web(); this.collList = oWebsite.get_lists(); list = collList.getByTitle('Urgent Alerts'); var ...


1

SharePoint CSOM List client object exposes List.AddItem method to create a new list item in the list: public ListItem AddItem( ListItemCreationInformation parameters ) Since CSOM is asynchronous, two approaches are commonly used when it comes to make CSOM code maintainable: Callbacks Deferred Callback approach function ...


1

You can refer this Section to add/update/Delete list items using javascript. Make sure 'SP.js' is loaded before you call your method to add list item.You can do that as below: SP.SOD.executeFunc('sp.js', 'SP.ClientContext', createListItem);//makes sure sp.js is loaded and then calls createListItem method function createListItem() { var ...



Only top voted, non community-wiki answers of a minimum length are eligible