Hi Anitha.A. AGE is not a supported field in orkut -- it will always
return null. The other two fields, CURRENT_LOCATION and GENDER, should
always be available for users with the app installed. In order to
retrieve these fields, you have to specifically request them. Let me
know if this code snippet works for you:
function callback(data) {
var owner = data.get('owner').getData();
var gender = owner.getField(opensocial.Person.Field.GENDER);
// gender is an OpenSocial.Enum object
output(gender.getDisplayValue());
var location =
owner.getField(opensocial.Person.Field.CURRENT_LOCATION);
// location is an OpenSocial.Address object
output(location.getField(opensocial.Address.Field.COUNTRY));
};
function request() {
var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[opensocial.Person.Field.GENDER,
opensocial.Person.Field.CURRENT_LOCATION];
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER,
params), 'owner');
req.send(callback);
};
request();
Notice that the gender field is returned as an opensocial.Enum object
while current location is an opensocial.Address object. So you should
look up the API reference to both in order to determine how to extract
the values, as I have above.
Cheers!
- Jason
On Oct 17, 2:35 am, Anitha <[EMAIL PROTECTED]> wrote:
> Hai sir,
>
> how to Retrive the gender and address of the orkut information. i
> always get that values as null i have written the code as follows and
> run in coderunner but it always shows null vlaues.
>
> /**
> * DEFAULT CODERUNNER SAMPLE CODE
> */
> function loadUsers() {
> var req = opensocial.newDataRequest();
> req.add(req.newFetchPersonRequest('OWNER'), 'owner');
> req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
> req.send(onLoadUsers);
> }
>
> function onLoadUsers(dataResponse)
> {
> var owner = dataResponse.get('owner').getData();
> var viewer = dataResponse.get('viewer').getData();
> var ownerId = owner.getField(opensocial.Person.Field.ID);
> var profileurl =
> owner.getField(opensocial.Person.Field.PROFILE_URL);
> output("The profile url was" + profileurl);
> output("The owner name is "+owner.getDisplayName());
> output(ownerId);
> output("Country was"
> +owner.getField(opensocial.Person.Field.CURRENT_LOCATION).Country);
> output("Gender was"+
> owner.getField(opensocial.Person.Field.GENDER));
> output("The age was"
> +owner.getField(opensocial.Person.Field.AGE));
>
> }
>
> i got age and gender and country information is null pls give me the
> reply as early as possible. pls do need help for this
>
> Thanks&Regards
> Anitha.A
> loadUsers();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Orkut Developer Forum" 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-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---