I'm using Salesforce Tooling API in my C# application. When I'm trying to run the query:

var res = sforce.query("select id from Attachment where parentid = '" + id + "'");

I get the following error:

INVALID_TYPE: sObject type 'Attachment' is not supported.

I can query Attachment only when using Partner API, but then I can get only sObject[] as there is no Attachment type in wsdl. I am logged in as System Administrator.

Am I missing something?

1 Answer 1


Tooling API is not meant for querying records or accessing salesforce data

Check this salesforce article for when to use Tooling API

You can definitely use Query method via standard enterprise / partner APIs to access Attachment object.


Yes, as you guessed, partner wsdl is loosely coupled and meant for flexible client implementations, which means you will have some work on parsing/type casting the results..

on the other side enterprise wsdl is strongly typed and will get you all the proxy classes you need to access from your client app.

you can also consider using the Force.com .NET Toolkit which abstracts most of this and keeps your integration simple.

and to your question on attachment object in tooling api, I believe it refers to email template attachments. If you do a search for attachment in the tooling api wsdl, the only reference is in the metadata part of emailtemplate type.

enter image description here

  • Ok, as I understand it now, there are no strongly typed objects at all in Partner API. One have to query the result from sObject.Any property, and it is just a raw XML. I'm still wondering why there is Attachment type in Tooling api (it has the byte[] body property). It's a bit confusing. I must say that querying Xml with linq to get the attachment is not the most comfortable approach. Jun 8, 2015 at 12:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .