1

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

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.

EDIT :

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. – Bart Juriewicz Jun 8 '15 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.