Tag Info

New answers tagged

0

You can deploy your app on your local farm for testing purpose then when you feel comfortable you can deploy on your SP Online and do the others tests


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); ...


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, ...


0

Try to load web object also after getting it, context.load(web); Moreover, try to get title and url using myPropBag.get_item("propertyname"). Similarly, use myPropBag.set_item("propertyname") to set properties.


0

As mentioned in comments for your question. If you call the web service using system account your service updates data also as system account. SharePoint workflows doesn't work correctly with system account. You need to use another account to call you service.


1

the "$limit=" option above does NOT work. however, the $top= does.


0

I used the following to hide the last empty row in datasheet view (where new items are added): //Add jquery reference <script type='text/javascript' src='../../SiteAssets/javascript/jquery-1.10.2.min.js'> </script> <script type='text/javascript'> //Use _spBodyOnLoadFunctionNames.push to prevent any collisions ...


0

Sharepoint 2007 (MOSS) and Sharepoint 2010 are two different environment and for console or other application can't access both these application url from a single box. If you run your program from MOSS environment, you can access the sites that are in SP 2010 and vice versa. So you have to take help of sharepoint web services. Take a look at Migrate ...


0

Almost two years passed but recently I’ve had the same problem with SharePoint 2013 (I’ve actually accessed SP2013 with SP 2010 CSOM libraries). Finally I’ve managed to sort it out. First, I assume the Kerberos authentication was functioning correctly in you case. Just to be on the safe side, you can turn off NTML authentication in IIS settings or display ...


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 ...


0

Setting Title value The line: listItem.set_item("Title", Title.name); is used for setting Title column from Title.name object. Are you using something like this to initialize Title object? var Title = {}; Title.name = $('#title').val(); Ensure sp.js library is loaded In order to ensure that sp.js is loaded, change function your function to ...


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 + ...


0

If you are using SharePoint 2013 you cannot use SaveBinaryDirect, it does not work with claims authentication. The call made by SaveBinaryDirect does not include the required authorization cookies. Details are discussed in the comments to this blog post: How to do active authentication to Office 365 and SharePoint Online


0

In the CAML Query, you need to set the view XML as: camlQuery.set_viewXml(q);


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


0

Try this: alert('Now moving to: ' + _destinationlibUrl); File.moveTo(_destinationlibUrl,1); It worked for me.


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. ...


0

As Aveenav suggested see whether they are included in your Include(). Also verify whether your DEFAULT VIEW is having these columns included in list settings.


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 ...


0

You can use <Today /> tag for comparing current date.Below is the code: var q = "<Where><Leq><FieldRef Name='Start Date' /><Value Type='DateTime' IncludeTimeValue='FALSE'><Today /></Value></Leq></Where>";


0

Try modifying your code with this bit : list = collList.getByTitle('Urgent Alerts'); this.items = list.getItems(); clientContext.load(items); clientContext.executeQueryAsync(Function.createDelegate(this, this.Success), Function.createDelegate(this, this.Failed)) function Success(sender, args) { var itemEnumerator= this.items.getEnumerator(); var ...


0

Use This link var oList; function theFunction() { var sListId = SP.ListOperation.Selection.getSelectedList(); var oWeb = item_clientContext.get_web(); oList = oWeb.get_lists().getById(sListId); // .load() tells CSOM to load the properties of this object // multiple .load()s can be stacked item_clientContext.load(oList); // now ...


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

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 ...


0

please see my post here, it will tell you how to add a SP.List item with all available column types by using JSOM http://pointofint.blogspot.com/2014/03/how-to-set-any-spfield-value-with-jsom.html


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); ...


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

It depends whether Lookup Field is multi-valued or single-valued. How to retrieve Lookup field via CSOM in SharePoint 2013 SP.LookupField value is represented as SP.FieldLookupValue object: //Get LookupField value var categoryValue = item.get_item('Category'); var catLabel = categoryValue.get_lookupValue(); var catId = categoryValue.get_lookupId(); ...


2

Use oListItem.get_item('Fruits') where Fruits is the internal name of the field.


5

Since SP.SOD.executeFunc supports on demand scripts, but SP.SOD.executeOrDelayUntilScriptLoaded does not, I would recommend to use SP.SOD.executeFunc with CSOM: SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function() { var clientContext = SP.ClientContext.get_current(); console.log(clientContext.get_url()); });


4

ExecuteOrDelayUntilScriptLoaded is a method used to delay a function call unless a particular script is loaded. Yes, you can use it in application page. If you are using CSOM you need to add a reference to sp.js file. You can also use SP.SOD.executeFunc if you are using on demand scripts. A very good article on this is here



Top 50 recent answers are included