Social Data Service - Add Comments - Url issue

May 3, 2011 at 3:10 PM

Im using the Add Comment method and trying to use a url like this:

"http://myintranet.com/social.aspx?list=1&item=3"

...but it keeps responding with "Bad request". So I thought, maybe it couldn't accept the url as is, so I encoded the url to this:

"http://myintranet.com/social.aspx%3Flist%3D1%26item%3D3"

...but it still has issues. I've looked at tons of MSDN docs and still have no clue why this isn't working. Can anyone help?

Coordinator
May 3, 2011 at 3:28 PM

spmetanav:

I'm not sure what you're trying to do here. Are you trying to use the REST services? social.aspx would be a plain old site page and not a Web Service or REST URL.

M.

May 3, 2011 at 4:20 PM

Ok so, my goal is to build a custom bookmarking tool using the comment service, weird I know...  but we've built custom pages that have queries in them like "http://intranet.com/custome.aspx?list=1&item=3" to display lists like CNN or BBC in our newsroom, it's cool and it loads super fast.

I saw on this page http://spservices.codeplex.com/wikipage?title=SocialDataService the operation "AddComment " and tried using it. It works when I try this:

 $('#MainContent').SPServices({
		operation: "AddComment",
		url: 'http://intranet.com/newsroom/page.aspx',
		title:'Just added a favorite bookmark',
		comment:'this is great',
		completefunc: function (xData, Status) {
		console.log($(xData.responseXML));
		}
	});
So I'm pumped that it works, but it doesn't help me bookmark the "page" that users see. If a user wants to bookmark a news item about a charity event the link they want to bookmark is 
"http://intranet.com/newsroom/page.aspx?list=1&item=3"
but I can't get SharePoint to accept that url... it just gives the error:

"Server was unable to process request. ---> Invalid URI: The format of the URI could not be determined."

I tried to excape and encode the url in javascript and got these different outputs:

  • http%3A//intranet.com/newsroom/page.aspx%3Flist%3D1%26item%3D3
  • http://intranet.com/newsroom/page.aspx%3Flist%3D1%26item%3D3

but nothings seems to work...

May 4, 2011 at 3:47 PM

I figured it out... basically it didn't like my '&' so I changed only that to '%26' and it works. I love this library by the way!

Coordinator
May 4, 2011 at 4:30 PM

Awesome. Glad you figured it out!

M.