Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all 6517 articles
Browse latest View live

New Post: Cascading Drop-Down Project (Information Gathering)

0
0
Everyone starts somewhere!

M.

New Post: CopyIntoItems using an XML string

0
0
CopyIntoItemsLocal is intended for copying an existing document into a new location. That's really the whole purpose of the Copy Web Service, as limited as it is.

I think what you want is UpdateListItems, as you are creating a new item.

M.

New Post: CopyIntoItems using an XML string

0
0
Hi Paul,

It is giving me an access denied in jQuery-1.6.2.min.js file, though, in my App, I tried giving full control in appmanifest.xml. Not sure, whats going wrong?

Hi Marc,

Will UpdateListItems method create a new file? I saw some blogs, which are saying, this method won't create a new file. Also, MSDN documentation also talks only about creating a new list item, but not a file. I may be wrong. Can you please advise?

[http://social.msdn.microsoft.com/Forums/sharepoint/en-US/f135aaa2-3345-483f-ade4-e4fd597d50d4/add-document-to-library-via-listsupdatelistitems]

[http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems(v=office.12).aspx]

New Post: CopyIntoItems using an XML string

0
0
Also, while using CopyIntoItems method in SP 2013 app, the Source / Destination URL will be the Host Web URL only and not the App Web URL, correct ?

New Post: CopyIntoItems using an XML string

0
0
I have no idea how the SOAP Web Services will hold up in the 2013 app model. Is there some reason you aren't using CSOM?

M.

New Post: CopyIntoItems using an XML string

0
0
Hi Marc,

My belief is that your library is much lighter, simpler and easier to use than CSOM. I am a big fan of your library and I love it. I will go for CSOM, only in the worst case, as my last option, since its complex and confusing, with much less documentation/support.

New Post: CopyIntoItems using an XML string

0
0
Re: access denied in Jquery

Are you going cross domain? It sounds that way.
I have not worked with the app model, so I'm not sure either. It could be that your app is on a different domain?


--

_________
Paul T

New Post: CopyIntoItems using an XML string

0
0
Yes Paul. App is on a different domain. Thanks for pointing that out. I think, I will have to use only CSOM here.

New Post: CopyIntoItems using an XML string

0
0
Heh. I should send those comments to the SharePoint Product Group. ;+)

M.

New Post: Aggregate Functions (SUM) using CAML

0
0
Can anyone please recommend the correct way of doing an aggregate sum? I'm stuck on this.

Ultimately I need to Sum the Amount for each user and then sort by the Total Sum Amount from highest to Lowest.

Thanks.

New Post: CopyIntoItems using an XML string

0
0
Marc,
Nah. I think this is an opportunity for a jquery library that wraps CSOM and makes it easy. Know anything about that type of thing?


--

_________
Paul T

New Post: Push InfoPath attachments into Document Library

0
0
I need to find a way to isolate, decode, and copy attachment (base64 encoded) files from an InfoPath XML into a document library.

I have had some success following this thread: http://spservices.codeplex.com/discussions/34473

But now I am stuck. I need to decode the output and move the attachment(s) to a document library. Ideally, I would use the Infopath form title as the title of a subdirectory to send the attachments to.

I am really new to jQuery, so any suggestions are appreciated.

New Post: Creating a new list item using UpdateListItems

0
0
Can someone provide information on how to use the UpdateListItems service to create new list items in list "B" from the information entered into list "A"? I am attempting to create a new associate list item based on the details entered into a project list item. The project list item will have details such as title, project ID, assigned resources, etc. I need to create a new associate list item in list "B" for each assigned resource indicated, while reusing the project record data.

List A Example: (Title / ProjectID / Assigned Resources)
Project SP / 1234 / David, Sally, Walter
individual List B Examples:
Project SP / 1234 / David
Project SP / 1234 / Sally
Project SP / 1234 / Walter
Heres a snippet of the code Im using which essentially creates a new list item at PreSave until all assigned resources have been used.

var revisedResources = updatedARvalue.split(";");
var rLength = revisedResources.length
 var singleAR="",i=rLength;
while (i != 0)
{
var singleAR = revisedResources.shift();
$j().SPServices({
    operation: "UpdateListItems",
    batchCmd: "New",
    listName: "{CAC80717-DB02-4140-BF50-0F1EA65CD70A}",      
valuepairs: [["ID",i],["Title",prTitle],["ProjectID",prID],["Assigned_x0020_Resource",singleAR]],
        debug: false,
        completefunc: null 
});
--i;
}

I dont know why this is not working properly; any help is appreciated.

New Post: cascading dropdown in "Quick Edit" view

0
0
Hello,

I would thank to everybody who is contributing to this useful library and I can work with it in New, Update form. However, I think it's not available for the "Quick Edit" view in SharePoint 2013. I would like to ask is there any update upcoming soon for the "Quick Edit" view in SharePoint 2013?

Thanks

New Post: Creating a new list item using UpdateListItems

0
0
William:

Your syntax seems a bit odd to me, though it seems as though it should work. When you say it's "not working properly", what is the result you're seeing?

M.

Created Feature: Get SPCascadeDropdowns Working with SharePoint 2013 Quick Edit View [10181]

0
0
SPCascadeDropdowns does not work with the "Quick Edit" view - aka the new Datasheet view - in SharePoint 2013 as of SPServices 2013.01.

New Post: cascading dropdown in "Quick Edit" view

0
0
qnguyen:

You are correct that SPCascadeDropdowns does not work with the "Quick Edit" view - aka the new Datasheet view - in SharePoint 2013 as of SPServices 2013.01.

In fact, it's been on my mental list to look at when I have the time. I've just added an item into the Issue Tracker for it. Feel free to vote it up if you've like to push it higher on the priority list:
https://spservices.codeplex.com/workitem/10181

M.

Commented Issue: async on version 2013.01 [10148]

0
0
From: https://spservices.codeplex.com/discussions/444799

I have an issue with a function not running async when upgrading SPServices to the new version. The issue I found was at line 1220 of SPServices. In the previous version, the async value was set to the async option I provide. In the new version, it defaults to false if a completefunc exists. In my case, I have a completefunc and still need it to be true for async. Is there something I am not seeing to do this? When I delete the "thisHasCompletefun ? false : " from that line, everything works for me but rather than changing spservices on my system, I'd rather understand the intent better.
Comments: Hi Marc. I have not have a chance to look at the source for 2013.02ALPHA2, but did the fix also address the issues on the thread around caching? Paul

Created Issue: async on version 2013.01 and caching [10182]

0
0

From https://spservices.codeplex.com/discussions/444799



Marc,
This is going to be long… I did not want to post yesterday night because I wanted to first do some testing so that I could prove my theories/observations... :)

(on a side note, before I begin: good job today at SPChat)

### __Issue 1: When cacheXML is true, completefunc() is not provided with the ajax “status”__

This one is an easy fix… You already have the Deferred object, which is resolved because it was cached… Just “add yourself” on to the chain and call the completefunc… Because the Deferred is resolved, your callback is executed immediately. Here is the code:

```
// Call the completefunc if there is one
if(thisHasCompletefunc) {

cachedPromise.done(function(xData, status){

opt.completefunc(xData, status);

});

}
// Return the cached promise
return cachedPromise;

```

You don’t want to force the status to be successful because you don’t currently have code that prevents the caching of the request if it status is ‘error’… So even if the request failed to be sent to the server (ex. invalid XML) it would still be cached (more on caching below)…

When I initially saw this yesterday, I was concerned as to why I have not seen this in the application I’m mostly working with now a days… Specially since I do have instances where I use cacheXML true (ex. retrieving list information) and I normally check the status field for “error” or “success”... Answer: I’m still using v0.7.2 which does not have this issue – you were using the cacheXML input option to determine if it should be cached or not.

(I also checked the “Black Magic for White Hats SharePoint” project I recently did and looks like I check for “error” explicitly and don’t do something like “If not success”, so I’m good there as well)


### __Issue 2: SPServices is *always* caching requests__


This one is the more concerning one and the one I wanted to do more testing on… SPServices currently caches __all__ Ajax requests regardless if the user sets cacheXML or not! (all operations – queries and updates a like)

My concerns are around memory and performance on the browser… From a functional standpoint, you still return the proper response based on cacheXML setting.
For a “casual” user, this will not be an issue – they make a few calls to SPServices… no problem… but… What about SPA’s (Single page applications)? These can make hundreds, if not thousands of calls for data during the life of the browser (tab) session… The memory footprint can grow to be very large. This all seems to have been introduced with the move to supporting Promises.

_(At this point I should say: shame on me… for not contributing to your request for feedback when you first implemented the cacheXML and Promises functionality… specially since I have a vested interest in this library for my own projects :) )_

I have a code suggestion which supports the following (personal) feeling toward caching – which echo’s the principle behind this original post about the async flag:

1. Only cache when asked (_cacheXML: true_)
2. Keep cached version until a subsequent request comes through with cacheXML == false… at this point: delete the cached version from memory.

I’m not going to worry about “cacheXML” being true by default (in the defaults object), which would make updates (ex. _UpdateListItems_) not actually make updates in some cases… (in SPA pages, it could happen). I would suggest adding something to the documentation under the _cacheXML_ option that most likely 1) it should not be set globally... and 2) should probably not be used on updates.


_Proposed Changes:_

The change is fairly simple and only moves around some of your variables that you already defined… basically, you assign the ajax object to _cachedPromise_ and only add that to _promisesCache[]_ object if _cacheXML_ is true. I took your code from v2013.01 and made only a few edits... Here it is:

```
// Check to see if we've already cached the results
var cachedPromise;
if(opt.cacheXML) {
cachedPromise = promisesCache[msg];
}

// If we don't have a completefunc, then we won't attempt to call it
var thisHasCompletefunc = $.isFunction(opt.completefunc);

if(typeof cachedPromise === "undefined") {

// Finally, make the Ajax call
cachedPromise = $.ajax({
// The relative URL for the AJAX call
url: ajaxURL,
// By default, the AJAX calls are asynchronous. You can specify false to require a synchronous call.
async: thisHasCompletefunc ? false : opt.async,
// Before sending the msg, need to send the request header
beforeSend: function (xhr) {
// If we need to pass the SOAPAction, do so
if(WSops[opt.operation][1]) {
xhr.setRequestHeader("SOAPAction", SOAPAction);
}
},
// Always a POST
type: "POST",
// Here is the SOAP request we've built above
data: msg,
// We're getting XML; tell jQuery so that it doesn't need to do a best guess
dataType: "xml",
// and this is its content type
contentType: "text/xml;charset='utf-8'",
complete: function(xData, Status) {
// When the call is complete, call the completefunc if there is one
if(thisHasCompletefunc) {
opt.completefunc(xData, Status);
}
}
});

// If cache is true, then store the ajax request
if (opt.cacheXML) {

promisesCache[msg] = cachedPromise;

// ELSE, cache must be false... Remove cached version (case it exists)
} else if (promisesCache[msg]) {

delete promisesCache[msg];

}

// Return the promise
return cachedPromise;

}

```

I wish I had line number to tell you exactly what's I'm suggesting... Hopefully its not to hard to pick out...

__Testing Code:__

I create the script below that I loaded dynamically through firebug and played with from the console by calling the functions…

```
/**
* Validate theory of v2013.01:
* 1. Always caches requests, regardless of cacheXML settings.
* Memory/Performance impact.
* 2. completefunc() receives different input params when using cached request.
*
*
*/

// Load script via dom so that we can see it in firebug
function loadSPServices(url) {

// Insert SPSErvices into page
// Need to use a non-minified version for debuging/stop points.
var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement,
s = document.createElement("script");
s.type = "text/javascript";
s.src = url;
s.onload = s.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !s.readyState || /loaded|complete/.test( s.readyState ) ) {

s.onload = s.onreadystatechange = null;
s = undefined;

console.log( "SPServices v" + $().SPServices.Version() );

}
};
head.insertBefore(s, head.firstChild);

}

function makeSPCall(options, loopCount, list) {

if (!loopCount) {

loopCount = 1;

}

var n = 1,
opt = $.extend(
{},
{
operation: "GetListItems",
listName: "Announcements",
cacheXML: false,
CAMLRowLimit: 1,
completefunc: function(xData, status){

console.log("status: " + status);
console.log("xData: ");
console.log(xData);

}
},
options
);



for(; n<=loopCount; n++){

$().SPServices( $.extend(opt, { CAMLRowLimit: n }) );

};

}


function makeUpdate(itemId, cache) {

$().SPServices({
operation: "UpdateListItems",
listName: "Announcements",
cacheXML: (cache === true ? true : false),
batchCmd: "Update",
ID: itemId,
valuepairs: [
["Title", "Title updated..."]
],
completefunc: function(xData, status){

console.log("status: " + status);
console.log("xData: ");
console.log(xData);

}
});

}


console.log("TEST FILE: Loaded");

```


Hope this helps in explaining my concerns and in testing... On a plus side: I used Chrome's profile tools to do Heap snapshots... I eventually crashed Chrome... :) (a few times)


Paul.

New Post: async on version 2013.01

0
0
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Viewing all 6517 articles
Browse latest View live




Latest Images