CVent and ID’s

Cvents system finds every user and event by their own id, before you can do anything with an event or a user, you must first do a search and find their/it’s id.

Getting and Events id by it’s event name

Public Function GetEventIdsByTitle(ByVal eventTitle As String, ByVal fieldVal As String) As String()
        'Array of EventIds
        Dim ids As String()
        'Create Cvent search object
        Dim thesearch As New com.cvent.api.CvSearch()

        'Create Cvent search filter object array
        'Create a one-row array of Filter objects
        'Create larger array if searching on multiple fields/filters
        thesearch.Filter = New com.cvent.api.Filter(0) {}
        thesearch.Filter(0) = New com.cvent.api.Filter()
        'Search by Event Title field and provided search criteria
        'EventTitle is a “searchable” attribute of the Event object
        'any searchable attribute can be added as a search filter

        thesearch.Filter(0).Field = eventTitle
        thesearch.Filter(0).Value = fieldVal
        'Search for all Event Titles that “start with” provided criteria
        thesearch.Filter(0).Operator = com.cvent.api.CvSearchOperatorType.Equals
        'Specify if the search filters should be used to build an “And” or “Or” search
        'search.SearchType = com.cvent.api1.CvSearchType.OrSearch
        'Perform search for event ids that match the search criteria
        'Note: Use same technique to search for other Cvent objects including
        'Contacts, Invitees, Registrations, Surveys, etc
        ids = _ws.Search(com.cvent.api.CvObjectType.[Event], thesearch)

        'Return string array of event ids
        DisplayEventsByIds(ids)
        Return (ids)
    End Function

The same type of search works for finding a user. CVent looks at the “sourceID” and the users email address to make sure they don’t have dupes, so these are the easiest fields to search for a user by. The sourceID is anything that your current system may use to identify users.

Public Function GetcontactIdsBysourceid(ByVal IndividualID As String) As String()
        Dim i As Integer = 0
        'Array of EventIds
        Dim ids As String()
        'Create Cvent search object
        Dim thesearch As New com.cvent.api.CvSearch()

        'Create Cvent search filter object array
        'Create a one-row array of Filter objects
        'Create larger array if searching on multiple fields/filters
        thesearch.Filter = New com.cvent.api.Filter(0) {}
        thesearch.Filter(0) = New com.cvent.api.Filter()
        'Search by Event Title field and provided search criteria
        'EventTitle is a “searchable” attribute of the Event object
        'any searchable attribute can be added as a search filter

        thesearch.Filter(0).Field = "SourceID"
        thesearch.Filter(0).Value = IndividualID
        'Search for all Event Titles that “start with” provided criteria
        thesearch.Filter(0).Operator = com.cvent.api.CvSearchOperatorType.Equals
        'Specify if the search filters should be used to build an “And” or “Or” search
        'search.SearchType = com.cvent.api1.CvSearchType.OrSearch
        'Perform search for event ids that match the search criteria
        'Note: Use same technique to search for other Cvent objects including
        'Contacts, Invitees, Registrations, Surveys, etc
        ids = _ws.Search(com.cvent.api.CvObjectType.[Contact], thesearch)

        'Return string array of event ids
        Return (ids)
    End Function

Technorati Tags: , ,

     

Leave a Reply