Collection Webservices

Nov 16, 2010 at 7:17 PM

I have a situation where I am wanting to use spservices.  However, it accesses the webs.asmx from the url.  In our environment our users do not have rights at the farm level.  They only have rights to the collection.  Ex..  http://this.farm.home/sites/siteIneed...  I need to change the jquery to access the webs.asmx from "siteIneed" not from "this.farm.home"..  Can you give me you guidance as to how to accomplish this.

Thanks

Jimmy

Coordinator
Nov 17, 2010 at 4:19 AM

Jimmy:

SPServices accesses the Web Services in the context you specify. So if you are in a site like

http://this.farm.home/sites/a/b/c

 and you call a Web Service operation with SPServices without specifying a webURL, the call would be in the context

http://this.farm.home/sites/a/b/c/_vti_bin/[WebServiceName].asmx

You can also specify a webURL in many cases, as indicated in the documentation.

Given all of this, if your users can access a site, Web Services calls from that site ought to work for them.

M.

Nov 17, 2010 at 6:32 PM
Thank You Mark. What I hadn't looked at was variables allowed for the spservices, instead I only looked a the function I was trying to invoke.
I appreciate your assistance.

>>> "sympmarc" <notifications@codeplex.com> 11/16/2010 10:19 PM >>>

From: sympmarc

Jimmy:

SPServices accesses the Web Services in the context you specify. So if you are in a site like

http://this.farm.home/sites/a/b/c

and you call a Web Service operation with SPServices without specifying a webURL, the call would be in the context

http://this.farm.home/sites/a/b/c/_vti_bin/[WebServiceName].asmx

You can also specify a webURL in many cases, as indicated in the documentation.

Given all of this, if your users can access a site, Web Services calls from that site ought to work for them.

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Nov 17, 2010 at 6:58 PM
My apologies for what is likely a silly question but I am unable to figure out how to accomplish this with the sparrangechoices function. I do not see weburl as something I can specify for it. What is happening is that the webs.asmx is being called from this.farm.home while the lists.asmx is coming from the correct location. So I am still unable to figure out how to get the webs.asmx from the site not the collection.
As this is my first project using your functions, I appreciate your help.

>>> "sympmarc" <notifications@codeplex.com> 11/16/2010 10:19 PM >>>

From: sympmarc

Jimmy:

SPServices accesses the Web Services in the context you specify. So if you are in a site like

http://this.farm.home/sites/a/b/c

and you call a Web Service operation with SPServices without specifying a webURL, the call would be in the context

http://this.farm.home/sites/a/b/c/_vti_bin/[WebServiceName].asmx

You can also specify a webURL in many cases, as indicated in the documentation.

Given all of this, if your users can access a site, Web Services calls from that site ought to work for them.

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Nov 17, 2010 at 7:22 PM

Jimmy:

I'm a little confused by what you are seeing, as is isn't what ought to be happening. If you don't specify a webURL, the current context is always used. The only way that the root of the farm would be used for the context (assuming you are not sitting in that site) is if you specify it.

M.

Nov 17, 2010 at 9:14 PM
Mark:
Here is my script.
<script type="text/javascript">
$(document).ready(function() {
$().SPServices.SPArrangeChoices({
columnName: "test",
perRow: 5
});
});
</script>
This works but while watching the console in firebug for this there are 3 webservice calls.
https://tkn.nash.tenn/_vti_bin/webs.asmx ----This is the one where we have auth issues.
So in essence my users have rights to https://tkn.nash.tenn/sites/........ but not to https://tkn.nash.tenn which is where the webs.asmx is being called from.
Thanks

>>> "sympmarc" <notifications@codeplex.com> 11/17/2010 1:22 PM >>>

From: sympmarc

Jimmy:

I'm a little confused by what you are seeing, as is isn't what ought to be happening. If you don't specify a webURL, the current context is always used. The only way that the root of the farm would be used for the context (assuming you are not sitting in that site) is if you specify it.

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Nov 17, 2010 at 9:33 PM

Ok, I think I see the issue. I'm calling SPGetCurrentSite and using url: "/_vti_bin/Webs.asmx". That's where your issue is, because your users don't have access to that root site. Unusual, but still.

Sorry to have missed this and for making you explain it three times!

This is the offending function:

 $.fn.SPServices.SPGetCurrentSite = function() {
  // Do we already know the current site?
  if(thisSite.length > 0) return thisSite;
  
  var msg = SOAPEnvelope.header +
    "<WebUrlFromPageUrl xmlns='http://schemas.microsoft.com/sharepoint/soap/' ><pageUrl>" +
    ((location.href.indexOf("?") > 0) ? location.href.substr(0, location.href.indexOf("?")) : location.href) +
    "</pageUrl></WebUrlFromPageUrl>" +
    SOAPEnvelope.footer;
  $.ajax({
   async: false, // Need this to be synchronous so we're assured of a valid value
   url: "/_vti_bin/Webs.asmx",
   type: "POST",
   data: msg,
   dataType: "xml",
   contentType: "text/xml;charset=\"utf-8\"",
   complete: function (xData, Status) {
    thisSite = $(xData.responseXML).find("WebUrlFromPageUrlResult").text();
   }
  });
  return thisSite;// Return the URL
 };

Unfortunately, it's non-trivial to fix. You could wire it up for your environment, but I need to come up with a more general solution.

M.

Coordinator
Nov 17, 2010 at 9:34 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Nov 19, 2010 at 4:53 PM

I think I may have a workaround for you which will make more sense than trying to address this edge condition in the library itself.

Try setting the default for the webURL before calling the other functions, something like this:

$().SPServices.defaults.webURL = "http://sitecollection/siteA";  // URL of the target Web

Check out the docs for the defaults function: http://spservices.codeplex.com/wikipage?title=$().SPServices.defaults

I think this will work, but let me know!

M.

Coordinator
Nov 23, 2010 at 3:28 AM

Jimmy:

Were you able to try this? Any luck?

M.

Nov 23, 2010 at 2:23 PM
Haven't had a chance. I am planning to try it this morning. Thanks for asking.

>>> "sympmarc" <notifications@codeplex.com> 11/22/2010 9:28 PM >>>

From: sympmarc

Jimmy:

Were you able to try this? Any luck?

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Nov 23, 2010 at 2:31 PM

Cool. Let me know!

M.

Nov 23, 2010 at 3:33 PM
Marc,
Do you suggest doing this before the (document).ready of after it but before the .spservices.sparrangechoices?

>>> "sympmarc" <notifications@codeplex.com> 11/22/2010 9:28 PM >>>

From: sympmarc

Jimmy:

Were you able to try this? Any luck?

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Nov 23, 2010 at 3:35 PM

Insode the $(document).ready and before you call any other SPServices functions.

M.

Nov 23, 2010 at 3:42 PM
It appears that it may be working. Thanks so much for all your help on this.

>>> "sympmarc" <notifications@codeplex.com> 11/23/2010 9:36 AM >>>

From: sympmarc

Insode the $(document).ready and before you call any other SPServices functions.

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Nov 23, 2010 at 3:52 PM

Excellent!

M.

Nov 23, 2010 at 4:23 PM
No my only problem is I can't get it to handle multiple radio buttons. I guess I was just not meant to do this.

>>> "sympmarc" <notifications@codeplex.com> 11/23/2010 9:52 AM >>>

From: sympmarc

Excellent!

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Nov 23, 2010 at 4:23 PM
Oops, that is in a custom form.

>>> "sympmarc" <notifications@codeplex.com> 11/23/2010 9:52 AM >>>

From: sympmarc

Excellent!

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Nov 23, 2010 at 4:28 PM

SPArrangeChoices ought to work with multiple radio buttons, even in a customized form. Check the Important Notes at the top of the doc page:
http://spservices.codeplex.com/wikipage?title=$().SPServices.SPArrangeChoices

You'll need to add that comment line above each column you want to use the function with. As I say, kludgy, but it works.

M.

Nov 23, 2010 at 4:48 PM
Thanks.

>>> "sympmarc" <notifications@codeplex.com> 11/23/2010 10:29 AM >>>

From: sympmarc

SPArrangeChoices ought to work with multiple radio buttons, even in a customized form. Check the Important Notes at the top of the doc page:
http://spservices.codeplex.com/wikipage?title=$().SPServices.SPArrangeChoices

You'll need to add that comment line above each column you want to use the function with. As I say, kludgy, but it works.

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Nov 23, 2010 at 5:30 PM
Ok. All works but I have one more question. I am sure there is a simple solution to this but I just can't seem to google the right thing.
So here goes. I have list with 3 fields.
1. Instructor
2. Instructor Cert number
3. Expiration date.
All I need to do is have the user select the Cert number and have the form autofill the other 2. I know I can do this with a workflow but is there another simple way?

>>> "sympmarc" <notifications@codeplex.com> 11/23/2010 10:29 AM >>>

From: sympmarc

SPArrangeChoices ought to work with multiple radio buttons, even in a customized form. Check the Important Notes at the top of the doc page:
http://spservices.codeplex.com/wikipage?title=$().SPServices.SPArrangeChoices

You'll need to add that comment line above each column you want to use the function with. As I say, kludgy, but it works.

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Nov 23, 2010 at 6:26 PM

Sure. Assuming the data is in a list somewhere, you can write some script which uses GetListItems to grab the data on the change event for Instructor Cert number and then populates the other two columns.

However, depending on what you will do with the data, that might not be a good idea. By that, I mean what happens if an expiration date or instructor changes? Would it be better to build a view which uses the two DataSources real-time using a DVWP?

M.

Nov 23, 2010 at 6:35 PM
Thanks. I think that will work. All I am needing to do is populate the data.

>>> "sympmarc" <notifications@codeplex.com> 11/23/2010 12:26 PM >>>

From: sympmarc

Sure. Assuming the data is in a list somewhere, you can write some script which uses GetListItems to grab the data on the change event for Instructor Cert number and then populates the other two columns.

However, depending on what you will do with the data, that might not be a good idea. By that, I mean what happens if an expiration date or instructor changes? Would it be better to build a view which uses the two DataSources real-time using a DVWP?

M.

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com