I love the way you guys always push me to find my own solutions. :P
The username is now being escaped correctly and all is good in the world.
As usual, I'm happy to share the solution with anyone who's interested.
From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Paul Noone
Sent: Wednesday, 10 September 2014 9:28 AM
To: ozMOSS
Subject: RE: Problems with Following using SP.UserProfiles

Right! So I've resolved issue 1. Passing in a valid user does wonders. :P

Would still appreciate any advice on issue 2 -  the best place and method to 
modify the username.


From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> 
[mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Paul Noone
Sent: Wednesday, 10 September 2014 8:21 AM
To: ozMOSS
Subject: RE: Problems with Following using SP.UserProfiles

OK. Making progress. I'm now getting stuck on two things.


1.       The username is being passed into the function as a string. Because 
domain\first.last contains a backslash,  Javascript is seeing it as 
domainfirst.last. So I need to pass the original value in as domain\\first.last.

Currently I'm passing it in raw from a MenuItemTemplateItem like so:

FollowMe.ClientOnClickScript = "getFollowingStatus('%UserName%')";

And Username is defined in my entity as:

emp.UserName = (String)profile[PropertyConstants.AccountName].Value;

2.  I can't seem to get the following status for my "actorInfo". :\ Has anyone 
had any success with this?

// Get the current client context.
   clientContext = SP.ClientContext.get_current();

   // Get the SocialFeedManager instance.
   followingManager = new SP.Social.SocialFollowingManager(clientContext);

   // Create a SocialActorInfo object to represent the target user.
   actorInfo = new SP.Social.SocialActorInfo();
   actorInfo.set_accountName(user);

   // Find out whether the current user is following the target user.
>> isFollowed = followingManager.isFollowed(actorInfo);
Any help appreciated.

Regards,

Paul

From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> 
[mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Paul Noone
Sent: Tuesday, 9 September 2014 11:04 AM
To: ozMOSS
Subject: Problems with Following using SP.UserProfiles

Hi all,

I borrowed some javascript from 
MSDN<http://msdn.microsoft.com/en-us/library/dn155790%28v=office.15%29.aspx#bk_FollowPeople>
 for a simple Follow/Unfollow link.

For whatever reason it's throwing undefined for:

"Unable to get property 'SocialFollowingManager' of undefined or null reference"

And:

"Unable to get property 'SocialActorInfo' of undefined or null reference"

Viewing source I can see that SP.UserProfiles.debug is already loaded by 
default.

RegisterSod("userprofile", "\u002f_layouts\u002f15\u002fsp.userprofiles.debug...

I've also tried loading SP.UserProfiles.js using both methods below but 
continue to have problems.

SP.SOD.executeOrDelayUntilScriptLoaded(getFollowingStatus, 
'SP.UserProfiles.js');
SP.SOD.executeFunc('SP.UserProfiles.js, 'SP.Social', getFollowingStatus);

Does anyone have any suggestions before I paste the full source?

Regards,

Paul

The content of this email is confidential to the intended recipient at the 
email address to which it has been addressed. It may not be disclosed to, or 
used by, anyone other than this addressee, nor may it be copied in any way. If 
received in error, please contact the author and then delete the message from 
your system.
Please note that neither Keller Australia nor the sender accepts any 
responsibility for viruses and it is your responsibility to scan the email and 
attachments (if any).
Visit http://www.keller.com.au/ for more information.

________________________________

This e-mail message has been scanned for Viruses and Content and cleared by 
MailMarshal

________________________________

The content of this email is confidential to the intended recipient at the 
email address to which it has been addressed. It may not be disclosed to, or 
used by, anyone other than this addressee, nor may it be copied in any way. If 
received in error, please contact the author and then delete the message from 
your system.
Please note that neither Keller Australia nor the sender accepts any 
responsibility for viruses and it is your responsibility to scan the email and 
attachments (if any).
Visit http://www.keller.com.au/ for more information.

________________________________

This e-mail message has been scanned for Viruses and Content and cleared by 
MailMarshal

________________________________

The content of this email is confidential to the intended recipient at the 
email address to which it has been addressed. It may not be disclosed to, or 
used by, anyone other than this addressee, nor may it be copied in any way. If 
received in error, please contact the author and then delete the message from 
your system.
Please note that neither Keller Australia nor the sender accepts any 
responsibility for viruses and it is your responsibility to scan the email and 
attachments (if any).
Visit http://www.keller.com.au/ for more information.

________________________________

This e-mail message has been scanned for Viruses and Content and cleared by 
MailMarshal

________________________________

The content of this email is confidential to the intended recipient at the 
email address to which it has been addressed. It may not be disclosed to, or 
used by, anyone other than this addressee, nor may it be copied in any way. If 
received in error, please contact the author and then delete the message from 
your system. 
Please note that neither Keller Australia nor the sender accepts any 
responsibility for viruses and it is your responsibility to scan the email and 
attachments (if any).
Visit http://www.keller.com.au/ for more information. 

--------------------------------------------------------------------------------
This e-mail message has been scanned for Viruses and Content and cleared by 
MailMarshal 
--------------------------------------------------------------------------------
_______________________________________________
Sponsored by Infotext - Amazing Search for Microsoft SharePoint - 
http://www.infotext.com/
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to