First of all you need to specify which fields to fetch, by default only the
id, name and thumbnail url are returned, so you need to
function init() {
var req = opensocial.newDataRequest();
* var params = {};**
params[opensocial.DataRequest.PeopleRequestFields
.PROFILE_DETAILS] = [
opensocial.Person.Field.PROFILE_URL** **
];*
req.add(req.newFetchPersonRequest(
opensocial.DataRequest.PersonId.VIEWER*, params*),
"req");
req.send(loadData);
};
Also, not every container has a about me field, so it's good practice to get
used to making some code conditional if you want to deploy your app on
multiple containers:
var supportsAboutMe =
*opensocial.getEnvironment().supportsField*(
opensocial.Environment.ObjectType.PERSON,
opensocial.Person.Field.ABOUT_ME
);
Hope that helps!
-- Chris
On Mon, Dec 15, 2008 at 6:19 PM, Amit Gupta <[email protected]> wrote:
>
> Hello Friends,
>
> I am beginner in open social development. I request please help me in
> following code.
>
> <![CDATA[
> <script>
> gadgets.util.registerOnLoadHandler(init);
>
> function init(){
> var req=opensocial.newDataRequest();
> var obj=req.newFetchPersonRequest('VIEWER');
> req.add(obj,'person');
> req.send(loadData);
> }
>
> function loadData(responseData){
> var
> person=responseData.get('person').getData();
>
> aboutme=person.getField(opensocial.Person.Field.ABOUT_ME);
>
> document.getElementById("msg").innerHTML=aboutme;
> }
> </script>
>
> <div id="msg"></div>
>
> ]]>
>
> I want to fetch ABOUT_ME field of OWNER. But everytime it shows
> UNDEFINED in output.
>
> Is there somthing missing in the code?
>
> Please help.
>
> Thanks in advance.
>
> Regards,
> Amit
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenSocial Application Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---