How to extract Email attachments IDs (CRM 3.0)

Howdy,

At some point, I was requested by a manager to extend the functionality of the email entity (multiplying the number of messages sent) and I came across the attachment side. The following function is my solution to the occurring issue:

// Author: Octavian Cucuta ( octavian.cucuta [ AT ] gmail.com )
// Release: 1.0.0.1 ( 2nd of December 2009 ) for MS CRM 3.0
// * Gets the IDs of the uploaded attachments, as a string constant with IDs separated by pipes ‘|’ characters
function GetEmailAttachmentsIDs()
{
// Returning results as a string, but locally storing data into an array, for a more practical approach
var result = Array();
// Encasing it all within a TRY{}CATCH{} block, to prevent unwanted errors
try
{
// Get table containers
var myTables = document.getElementsByTagName(“table”);
// Since MS did not specify a unique ID or name for the table,
// checking which one has the correct ‘oname’ tag.
// Tip: on email, the table we need is the 48th
for(var i = 0; i < myTables.length; i++)
{
if(myTables[i].oname == “1001”)
{
// Get attachment IDs
var index = 0;
for(var j = 0; j < myTables[i].rows.length; j++)
{
result[index] = “”;
result[index++] = myTables[i].rows[j].oid;
}
// Cancelling the processing loop here
break;
}
}
}
catch (err)
{
// In case something went wrong, instead of providing a partial set of attachments, return none
result = Array();
}

// Format output as a single string constant, separated by pipes
return result.join(‘|’);
}

// Usage: place this function inside the needed event code body, then use the following call
var ids = GetEmailAttachmentsIDs();

3 comments

  1. I inclination not approve on it. I regard as polite post. Especially the appellation attracted me to read the sound story.

  2. Good brief and this fill someone in on helped me alot in my college assignement. Thank you seeking your information.

  3. Genial brief and this enter helped me alot in my college assignement. Say thank you you on your information.

Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *