In the post Eloqua API How To: Create a Contact Group we looked at creating a new Contact Group asset.  Since Eloqua does not allow more than one asset type with the same name (in the same instance), when creating a new asset, it is very useful to know the names of existing assets of the same type.


That's when DescribeAssetType comes in handy.


The DescribeAssetType operation is used to list all of the entities of a particular type available in an instance. 


The following snippet will return all of the ContactGroup type Assets for a given Eloqua instance:

Note: we will assume that the code from here is also being used.


          //Set up the Eloqua Service
          var service = new EloquaInstance("instance", "userid", "password");  

          // Execute the request
          DescribeAssetTypeResult result = service.ServiceProxy.DescribeAssetType("ContactGroup");

          //Extract the ID, Name and Type of each Asset Type
          foreach (AssetType AssetType in result.AssetTypes)
                         Console.WriteLine(String.Format("ID: {0}", AssetType.ID));
                         Console.WriteLine(String.Format("Type: {0}", AssetType.Type));
                         Console.WriteLine(String.Format("Name: {0}", AssetType.Name));


You can now loop through the returned data, and check to make sure that Contact Group you are trying to create does not already exist.