fiogf49gjkf0d Hello,
I am using this code to get the groups available to a given user and putting them in a drop list box in an ASP.NET site. I get the list of groups just fine. Along with the description I need the plugin id. So I can get the list of contacts associated with the selected group
For the life of me, I cannot figure out if the return contains the plugin ID. Can someone please help ? what would the name of the field be? I have tried many different names.
***** Get the groups *******
.......
public AtomFeed GetGroupsSData(string sUserId, string sMode)
{
AtomFeed feed = null;
try
{
SDataService service = new SDataService("https://XXXXXXXX/sdata/slx/system/-/", LocalData.USERNAME, LocalData.PASSWORD);
SDataResourceCollectionRequest sdataCollection = new SDataResourceCollectionRequest(service)
{
ResourceKind = "groups",
QueryValues =
{
{
"where", "family eq '" + sMode + "'"
}
},
};
feed = sdataCollection.Read();
service = null;
......
***** Load the drop list ********
...
AtomFeed feed = slx.GetGroupsSData(LocalData.USERID, dlMode.SelectedItem.Text);
int pos = 0;
try
{
if (feed != null)
{
foreach (AtomEntry tempEntry in feed.Entries)
{
SDataPayload group = (SDataPayload)tempEntry.GetSDataPayload();
if(group.Values["name"].ToString() != null )
{
ListItem lst = new ListItem(group.Values["name"].ToString(), group.Values["????????????????????"].ToString() );
dlSelectGroupName.Items.Insert(pos++, lst);
}
}
}
}
catch (SDataClientException sdE)
....
***** Get the contacts ******
....
var uri = new SDataUri("https://XXXXXX/sdata/slx/system/-/groups/$queries/execute")
{
Select = "*",
QueryArgs = { { "_groupId", "Here is where I need to add the PluginID. How do I get it ?????" } },
StartIndex = 0,
};
var request = new SDataRequest(uri.ToString())
{
UserName =sUerName,
Password = sPassword
};
string account = string.Empty;
string contactName = string.Empty;
string title = string.Empty;
string WorkPhone = string.Empty;
string MobilePhone = string.Empty;
int iCount = 0;
var response = request.GetResponse();
var feed = (AtomFeed)response.Content;
foreach (AtomEntry tempEntry in feed.Entries)
{
SDataPayload payload = (SDataPayload)tempEntry.GetSDataPayload();
account = string.Empty;
contactName = string.Empty;
WorkPhone = string.Empty;
MobilePhone = string.Empty;
iCount++;
// Now read some values from the payload. Note, the
// property names you use here need to match the property
// names defined for the entity (these are case-sensitive).
account = payload.Values["ACCOUNT"].ToString();
contactName = payload.Values["NAMELF"].ToString();
if (payload.Values["MOBILE"] != null)
MobilePhone = payload.Values["MOBILE"].ToString();
if (payload.Values["WORKPHONE"] != null)
WorkPhone = payload.Values["WORKPHONE"].ToString();
//rtResults.Text = rtResults.Text + "Account - " + account + " Name - " + contactName + "Mobile Phone - " + MobilePhone + "Work Phone - " + WorkPhone;
rtResults.Text = rtResults.Text + "Count - " + iCount.ToString() + " Name - " + contactName + "\r\n";
}
....
|