+ Start a Discussion
ms0713ms0713 

Is it possible to get list of folders of Email Template using listMetadata() ?

ListMetadataQuery query = new ListMetadataQuery();

 query.type = "ApexClass";

 double asOfVersion = 23.0;

 // Assume that the SOAP binding has already been established.

 FileProperties[] lmr = metadataService.listMetadata( new ListMetadataQuery[] { query }, asOfVersion);

if (lmr != null)
{
  foreach(FileProperties n in lmr)
{
  string filename = n.fileName;
}
}


 I m using this code to get list of Apex classes.

I want list of folders for //***query.type = "EmailTemplate";***// component type.

Is it possible using listMetadata() method or any other way to achieve this?

please reply asap.

thanks in advance.
Best Answer chosen by Admin (Salesforce Developers) 
dmchengdmcheng

Folder[] x = [select Type from Folder where Type = 'Email'];

system.debug(x);

All Answers

dmchengdmcheng

Have you tried querying the Folder object where Type = Email?

ms0713ms0713

I have tried it and it gives me error like "INVALID_TYPE: Unknown type:Email".

dmchengdmcheng

I don't know.  The query works fine with Apex and SOQL within Salesforce.

ms0713ms0713

By the way, I am using it in C# and previously provided code was in C#.

 

But can you give me the code that works fine with SOQL and Apex.

 

Thanks.

dmchengdmcheng

Folder[] x = [select Type from Folder where Type = 'Email'];

system.debug(x);

This was selected as the best answer
ms0713ms0713

Now i want list of all the Standard objects.

 

Can you help me?

 

Reply ASAP.

 

Thanks.

 

 

 

Rescian Rey 5Rescian Rey 5
The answer here is No. listMetadata() has no way of listing down all Email Template folders.