Help - Search - Members - Calendar
Full Version: IUser property values (Country, City, Sex, Birthday, etc) do not seem to work
Skype Community > English > Development, Betas and Skype Garage > Skype Public API
Stefan van As
Hi,

When I grab some user (via ISkype.User[username]), then all the properties (Country, City, Sex, Birthday, etc) are "unknown" (empty, zero, etc) until I open up the profile dialog on that particular Skype user (via ISkype.Client.OpenUserInfoDialog).

Is this a known problem? Is there any way to force an IUser instance to "update" itself, and get the actual properties values for Country, City, Sex, Birthday, etc? (without having to open up the profile dialog first).

Thank you,

Stefan.
Avo Nappo
> Is this a known problem?

No it isn't, just tried to reproduce this and all Skype.User[username] properties seemed to load just fine without, UserInfo dialog being open.
Stefan van As
QUOTE(Avo Nappo @ Sat Jun 2 2007, 10:17) [snapback]401953[/snapback]

> Is this a known problem?

No it isn't, just tried to reproduce this and all Skype.User[username] properties seemed to load just fine without, UserInfo dialog being open.


What Skype/API version are you using? (I'm running Skype client version 3.1.0.152 w/ COM API version 1.0.27.0)

Here's my (Delphi) code. Am I doing anything wrong here?

if not Assigned(FSkype) then FSkype := SKYPE4COMLib_TLB.TSkype.Create(nil);
AUser := FSkype.User[Handle];
if Assigned(AUser) then
begin
if Length(AUser.Country) > 0 then
Result.Country := AUser.Country
else
Result.Country := RS_UNKNOWN;

if Length(AUser.City) > 0 then
Result.City := AUser.City
else
Result.City := RS_UNKNOWN;
end;


Just to be sure: I'm retrieving some user who is NOT in my contacts list. Basically, that person is completely unknown to me. All I have is his/her skype handle.

All the IUser properties (Country, City, Birthdate, etc) return null or zero, until I bring up the profile dialog (via ISkype.Client.OpenUserInfoDialog). As soon as I have brought up the profile dialog on that particular Skype user, everything is fine and I can retrieve all the IUser properties (Country, City, Birthday, etc).

Any ideas?

Thanks, Stefan.
Avo Nappo

> if not Assigned(FSkype) then FSkype := SKYPE4COMLib_TLB.TSkype.Create(nil);

After creating FSkype object, add following line:

FSkype.Attach(7, true);

See if that helps. Also, there are few Delphi examples for Skype4Com listed under:
https://developer.skype.com/Docs/Skype4COM/Example
jbond
I rather think there may be a problem with getting those properties. I suspect the COM control (or the underlying API) is returning the User before it's retrieved all the properties. I find it sometimes works the second time you make the call to get the user.
Avo Nappo
> I rather think there may be a problem with getting those properties.

Did you try it with Attach? Looking at your example Im somewhat surprised you got anything back from those properties at all.
jbond
QUOTE(Avo Nappo @ Mon Jun 4 2007, 09:37) [snapback]402466[/snapback]

Did you try it with Attach? Looking at your example Im somewhat surprised you got anything back from those properties at all.


Different person. Yes the API App is definitely attached.
Stefan van As
QUOTE(Avo Nappo @ Mon Jun 4 2007, 09:37) [snapback]402466[/snapback]

> Did you try it with Attach? Looking at your example Im somewhat surprised you got anything back from those properties at all.


Yes, of course I'm "attached". Otherwise, there wouldn't be any communication with the Skype client at all.

Anyway, I did some more investigation, and found out the following: when the profile dialog appears *for the 1st time*, it starts out *without* all the user properties (basically, it displays the skype username only). Pretty soon, async replies are coming in, and the actual user properties are retrieved. The profile dialog then expands in order to display those user properties.

On my end, the IUser properties are unknown (empty, zero, null), until that profile dialog is brought up on that particular skype user at least once, and it has retrieved all the user properties.

Now I want to have access to the "real" user properties without having to display the profile dialog. Is there some command that does what the profile dialog does? (basically: ask for all the actual user properties).

Thanks, Stefan.
jbond
QUOTE(Stefan van As @ Mon Jun 4 2007, 10:40) [snapback]402485[/snapback]

Anyway, I did some more investigation, and found out the following: when the profile dialog appears *for the 1st time*, it starts out *without* all the user properties (basically, it displays the skype username only). Pretty soon, async replies are coming in, and the actual user properties are retrieved. The profile dialog then expands in order to display those user properties.

On my end, the IUser properties are unknown (empty, zero, null), until that profile dialog is brought up on that particular skype user at least once, and it has retrieved all the user properties.


Slightly different but related problem. Am I right in thinking that skype.user('handle') only has data for the user properties if the user handle is already known to the client? eg User is in my contacts list, or in a chat I've got bookmarked. I'm getting different results on two different machines.

Stefan's results match what I'm finding. If I do a search and request properties for a found user, I don't get anything. Try it again a few seconds later and the properties are filled.
TheUberOverlord
Does this IE example help?

You can also do a search with it to see Skype names that are not in your Skype contact list.

http://testing.onlytherightanswers.com/skypebeta/Users.htm

This example is from the Example page located at:

https://developer.skype.com/Docs/Skype4COM/Example

Stefan van As
QUOTE(TheUberOverlord @ Mon Jun 4 2007, 22:55) [snapback]402726[/snapback]

Does this IE example help?

You can also do a search with it to see Skype names that are not in your Skype contact list.

http://testing.onlytherightanswers.com/skypebeta/Users.htm

This example is from the Example page located at:

https://developer.skype.com/Docs/Skype4COM/Example


That example doesn't seem to be working for me at all.

Skype client is up-and-running, and so is the Skype4COM API. I'm running IE 7.

Error on Page. Line: 20, Char: 1. Error: "Skype" is undefined.

Am I missing something?

Thanks, Stefan.
TheUberOverlord
QUOTE(Stefan van As @ Mon Jun 4 2007, 17:24) [snapback]402733[/snapback]

That example doesn't seem to be working for me at all.

Skype client is up-and-running, and so is the Skype4COM API. I'm running IE 7.

Error on Page. Line: 20, Char: 1. Error: "Skype" is undefined.

Am I missing something?

Thanks, Stefan.


This requires ActiveX to be working, check your IE7 and make sure ActiveX is allowed to run,
jbond
QUOTE(TheUberOverlord @ Mon Jun 4 2007, 23:59) [snapback]402739[/snapback]

This requires ActiveX to be working, check your IE7 and make sure ActiveX is allowed to run,


I definitely have Skype4Com installed and registered. But after much fiddling with IE7 permissions, I still can't get beyond "Skype" is undefined.

The in browser example is presumably doing the same thing as the API search and User Property calls. So how does this answer the questions in the thread?
TheUberOverlord
QUOTE(jbond @ Tue Jun 5 2007, 01:33) [snapback]402803[/snapback]

I definitely have Skype4Com installed and registered. But after much fiddling with IE7 permissions, I still can't get beyond "Skype" is undefined.

The in browser example is presumably doing the same thing as the API search and User Property calls. So how does this answer the questions in the thread?


Since you can't see the working example. I can only tell you that it supports looking up user data for both contacts as well as Skype users not in your contact list.

I have had many people try this example using IE7 and it worked fine, it maybe a IE security setting or Skype setting that is not allowing you to run this.

Stefan van As
QUOTE(TheUberOverlord @ Tue Jun 5 2007, 16:55) [snapback]402926[/snapback]

Since you can't see the working example. I can only tell you that it supports looking up user data for both contacts as well as Skype users not in your contact list.

I have had many people try this example using IE7 and it worked fine, it maybe a IE security setting or Skype setting that is not allowing you to run this.


This (IE users) example proves my point, because it calls Skype.SearchForUsers *before* any of the IUser properties are retrieved. Without SearchForUsers (or without bring up the profile dialog on that particular user), the IUser properties for any skype user who is NOT in your contact list are "unknown" (empty, zero, null, etc)

1. Sign out of the Skype client
2. Log into the Skype client
3. Using the Skype4COM API, attach to the Skype client, and
4. retrieve a user who is NOT in your contact list (I'm using Skype.User["arturinch"], but anyone will do)
5. Notice how the COUNTRY property (or any other property other than HANDLE and FULLNAME) is empty
6. Bring up the profile dialog for that particular user
7. Repeat step #4, and notice how the COUNTRY property now reads "Latvia".

Anyway, I guess I have answered my own question. I need to call Skype.SearchForUsers *before* I ask for any of the IUser properties. Otherwise, no IUser property values.
jbond
I'm pretty certain this is a bug in the API in 3.2.
I suggest you post it in Jira.
jbond
Here's what I'm currently finding.

1) Find a handle that is not in your contacts list using another copy of skype on another PC so that this one doesn't get the handle's properties.
2) Use the API. skype.User['handle']. The call returns but all properties are empty.
3) Use skype.SearchForUsers('handle'). It takes a while but when the call returns, handle will be one of the Users returned in the UserCollection and it has all properties filled and available.
4) Use skype.User['handle'] again. The call returns and this time properties are filled.
From then on skype.User['handle'] for the same handle works and returns property values.

It feels like Skype is cacheing the property values locally. Doing a search manually, retrieves the values and stores them. Doing a search from the API sometimes gets the full values. For me, it's now doing it all the time. Once the values are local, skype.User works to retrieve them but if it's called on its own and the handle properties have never been retrieved by this copy of skype on this machine, it returns an empty User.

The local cache seems to be in memory. Restart Skype and the process above repeats.

I've tried this with Skype.cache set both off and on. Same effects.
Stefan van As
QUOTE(jbond @ Sat Jun 9 2007, 17:09) [snapback]404417[/snapback]

Here's what I'm currently finding.

1) Find a handle that is not in your contacts list using another copy of skype on another PC so that this one doesn't get the handle's properties.
2) Use the API. skype.User['handle']. The call returns but all properties are empty.
3) Use skype.SearchForUsers('handle'). It takes a while but when the call returns, handle will be one of the Users returned in the UserCollection and it has all properties filled and available.
4) Use skype.User['handle'] again. The call returns and this time properties are filled.
From then on skype.User['handle'] for the same handle works and returns property values.


Confirmed. I'm seeing the exact same thing.

Like I said: all the user properties (City, Country, Birthday, etc) for any user that is NOT in your contacts list are "unknown" (empty, zero, null, etc) until either the profile dialog has been brought up on that particular user, or SearchForUsers has been called on that particular user. When OpenUserInfoDialog or SearchForUsers is called, the user properties are received asynchroneously (that's the reason the profile dialog expands while more and more user info is coming in).
jbond
Some more info. See the API docs under the User object

NB! When you retrieve USER object records with SEARCH USERS command, the user profile data is guaranteed to be accessible with GET USER <user_id> <property_name> commands only until another SEARCH command is executed. The reason for this is that big SEARCH commands can and often trigger Skype's internal garbage collection routine that can clear out the data retrieved by previous searches.

There seems to be a local cache internal to the client of User property data. GET USER <user_id> <property_name> returns the contents of the cache which will be Null if there's nothing there. So in general the results from GET USER <user_id> <property_name> are inconsistent and only guaranteed immediately after a search. The profile data is in the P2P cloud so a search can take some time to return.

If I click on a link like skype:someUnknownHandle?userinfo The UI opens a profile window for someUnknownHandle pretty quickly. Behind the scenes it must be doing a search for an exact match to get the data. I think this suggests an improvement to the API where you can do a search for an exact match on handle. At the moment it uses wild cards eg *someUnknownHandle* someUnknownHandle123. At the moment both search and async search don't return until a timeout or success. Search for exact match would return much quicker if the exact match was easily found.

There doesn't seem to be any obvious flag to say that GET USER <user_id> <property_name> has failed. A test of "FullName" is probably enough, otherwise you really need to check every property. In the end the only test is to do the search. If there's no results, then <user_id> doesn't exist.

I think we can write code to work around this, although if the data isn't immediately available it's going to be slow. Otherwise we'll have to wait for fixes or enhancements in the API.

BTW. I think prior to the latest hotfixes and betas Search was broken as well. Even immediately after a search, GET USER <user_id> <property_name> didn't necessarily have any data.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.