鉴于用户ID,我正在寻找一种方法来从Cvent获取用户注册的所有事件。
这比获取所有 Cvent事件更理想,并过滤掉用户未注册的事件。
这是"搜索"我试过的方法:
CvSearch userEventSearch = new CvSearch();
userEventSearch.Filter = new Filter[1];
userEventSearch.Filter[0] = new Filter();
userEventSearch.Filter[0].Operator = CvSearchOperatorType.Includes;
userEventSearch.Filter[0].Field = <What field to use here?>;
userEventSearch.Filter[0].Value = <userid>;
ids = _cventClient.Search(ref _sessionHeader, CvObjectType.Event, userEventSearch).ToList();
我正在查看我可以选择的字段列表,但我不相信它们中的任何一个与我想要的信息有关: http://tek-works.com/cvent-api-event-fields-and-their-format/
此外,还有一个&#34;检索&#34;可能有用的方法,但我不相信这对我非常有用:
CvObject[] objects = _cventClient.Retrieve(ref _sessionHeader, CvObjectType.<What CvObjectType to use here?>, new[] { <userid> });
我试图弄清楚是否有解决办法来获取我需要的信息。 (例如,我是否需要检索注册并与它们一起工作以获取我需要的事件?)
提前致谢!
答案 0 :(得分:0)
对于后人我发现了。也许这将有助于未来的其他人。您必须首先搜索并检索用户的所有注册。
完成后,您可以使用这些注册来获取EventIds:
// First search for all registrations for this user using their contact id (SourceId).
CvSearch userRegistrationSearch = new CvSearch();
userRegistrationSearch.Filter = new Filter[1];
userRegistrationSearch.Filter[0] = new Filter();
userRegistrationSearch.Filter[0].Operator = CvSearchOperatorType.Includes;
userRegistrationSearch.Filter[0].Field = "SourceId";
userRegistrationSearch.Filter[0].Value = registeredContactId;
var registrationIds = _cventClient.Search(ref _sessionHeader, CvObjectType.Registration, userRegistrationSearch);
// Using the results of that search, retrive all the registrations from Cvent
var registrations = _cventClient.Retrieve(ref _sessionHeader, CvObjectType.Registration, registrationIds).ToList().ConvertAll(items => (Registration)items);
// Return all the event ids from these registrations.
return registrations.Select(r => r.EventId).ToList();