New answers tagged

0

Here is the code to set the welcome page: var context = null; var web = null; var rootFolder = null; var welcomePage = 'SitePages/Home.aspx'; SetWelcomePage(); function onSuccess() { context = new SP.ClientContext.get_current(); web = context.get_web(); rootFolder = web.get_rootFolder(); context.load(web); context.load(rootFolder); ...


0

@Arsalan, Hyperlink appears fine if viewed in Allitems.aspx or any other created view. However, in Displayform or Modal View it shows the code. Sorry, earlier had quoted for visible in Display form but not in modal view.


0

You could consider the following modified example for enumerating all sites within site collection: function enumWebs(propertiesToRetrieve, success,error) { var ctx = SP.ClientContext.get_current(); var rootWeb = ctx.get_site().get_rootWeb(); var result = []; var level = 0; ctx.load(rootWeb,propertiesToRetrieve); result.push(rootWeb); ...


-1

In CSOM C# you can use var url = clientContext.Web.Url;


0

using (ClientContext context = new ClientContext("http://SharepointURL/")) { try { Web web = context.Web; FileCreationInformation newFile = new FileCreationInformation(); newFile.Content = System.IO.File.ReadAllBytes(@"C:\test.txt"); newFile.Url = "test.txt"; List docs = web.Lists.GetByTitle("CustomList"); ...


0

You would use CAML inside your JavaScript, here's how to use it: http://blog.bonzai-intranet.com/analysthq/2014/10/adding-an-xsltlistviewwebpart-with-a-custom-view-using-javascript/


0

Below code is working fine for me. Yours is same except I see execute query command to be missing. Also check if the location specified in the error is accessible and correct parameters are being passed in FileName and ReadAllBytes(). var attInfo = new AttachmentCreationInformation(); attInfo.FileName = mFile.Name; attInfo.ContentStream = new ...


1

Images, Site Collection Images This system library was created by the Publishing feature to store images that are used on pages in this site.” (not in SPListTemplateType) Also: Asset Library in 2010 just using a foreach loop to iterate through the SPWeb.Lists collection and then check each list's BaseTemplate value to get all the picture and ...


1

If you use REST to query the library, you'll notice that the template type ID is 851, which was introduced in SharePoint 2010. You'll see the details in the result of REST query. http://<<server>>/_api/web/Lists/getByTitle('LibraryTitle') Also here's a table showing you the details: ...


1

Here you go: (int)list.BaseTemplate == 109 | // Picture Library (int)list.BaseTemplate == 851 // Asset Library Note: The BaseTemplate property is of type SPListTemplateType which is an enum containing the template ID's of a number of the OOTB list definitions. The Asset Library however, is not included in the enum.


0

'SP.ClientContext.get_current' is null or not an object You are trying to access 'SP.ClientContext' while libraries are being loaded. So use this line of code to wait until the library is loaded. SP.SOD.executeOrDelayUntilScriptLoaded(getCurrentUser, 'SP.js'); SP.SOD.executeOrDelayUntilScriptLoaded(getCurrentUser, 'SP.js'); function ...


0

It shows [object object] in your alert message because you are trying to display an object instead of its properties. [Object object] is the default serialization of an object in JavaScript. You can use JSOM or REST API to get current user as follows JSOM function getCurrentUser() { var context = new SP.ClientContext.get_current(); var ...


1

At first glance (and its late saturday afternoon here, and the sun is out and its above 20 celcius for the first time, and I have had some beer) You are running into JavaScrip scoping issues: var passedData = { dfd: d, idx: i }; is the line that worries me, (it is almost a philosophical question... but that must be the beer) where does i come from? You ...


0

Simpler CAML - items created by current user query.Query = @"<Where> <Eq> <FieldRef Name='Author' /> <Value Type='User'><UserID/></Value> </Eq> </Where>";


0

It depends :) if these columns are just fields that you added on the page content type or on the page library itself and they are added on the page layout, then it is as easy as update the columns with the link you like. I believe this is not the case, and the links are stored as a part of the page content field. This will require to search and replace ...


0

change to the following : function getUserName() { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function(){ var context = SP.ClientContext.get_current(); var site = context.get_web(); }); }


0

Since you are using executeQueryAsync method of SharePoint it will process the request aysnchronously. Have a look at jquery Deferred variable to control your aynchronous operations. Sample code: var deferred = $.Deferred(); for(var i = 0; i < result.length; i++){ queryList(i).done(function(resultArr) { MasterProjectDataSuccess(); }) .fail(function(){ ...


0

I have answered on this question: Files move from one library to another library using jsom Here i have set array globally. Push and load the item one by one in array with Looping of itemcollection Get array result in executeQueryAsync-success function


1

Like Amal Hashin said, you've opened a <FieldRef>, but you should close it like that : <FieldRef Name='Mise à jour parc' /> <Value Type='Text'>Non</Value> Also I saw a mistake in your code. You use collListItemToBeUpdatedReventeas variable to print the result of the query. The problem is that you use that variable several times in ...


1

Your query is wrong. Try below query instead camlQuery.set_viewXml("<View> <Query> <OrderBy> <FieldRef Name='Mise à jour parc'> </FieldRef> </OrderBy> </Query> </View> ");


0

Can you try with this SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function(){ getItemsToBeUpdatedReventeTot(); getItemsToBeUpdatedReventeMaj(); }); Hope this should work. or you can also try with _spBodyOnLoadFunctionNames.push("getItemsToBeUpdatedReventeTot"); _spBodyOnLoadFunctionNames.push("getItemsToBeUpdatedReventeMaj");


0

If the list item is a document then you can use the MapToIcon method of the SPUtility class if (Item.File != null) { SPUtility.MapToIcon(Web, Path.GetExtension(Item.File.Name), string.Empty, IconSize.Size16); }


2

Document sets are just "fanzy" folders, so you have to use scope RecursiveAll. query.ViewXml = "<View Scope=\"RecursiveAll\" /> "; Or simply use the CreateAllItemsQuery that sets the same caml markup: CamlQuery query = CamlQuery.CreateAllItemsQuery();


0

It's according to what I understand, Scenario: You need same value in both Human Resources Document Category and HR Document Category columns. As both are lookup columns and both are pointing to different lists for that. Possible solution: If Human Resources Document Category has test1 value, then fetch that value (test1) by firing caml query in list ...


1

Try this if it works for you. You can avoid first five items using below mentioned listitems.getEnumerator() code. function getItemsToBeUpdated() //this function called on button click to get ID's { var clientContext = new SP.ClientContext.get_current(); var oList = ...


0

I would grab the first 10 items, store them in an array, then return the last 5 items from the array.


0

To get items from specific folder without receursive add to query this options: <QueryOptions> <Folder>thelist/thefolder</Folder> </QueryOptions> Note to replace thelist/thefolder with actual relative url


0

I had the same problem and used the suggestion from Brandon in the above comments to get rid of it: Just call spListItem.refreshLoad(); before updating the item.


2

SP.CamlQuery does not have a property RowLimit , you have to set in the caml markup: camlQuery.set_viewXml("<View><Query> <OrderBy> <FieldRef Name='ID' Ascending='False' /> </OrderBy> </Query> <RowLimit>5</RowLimit> </View>");



Top 50 recent answers are included