N
neilsg2001
Hi,
I have successfully managed to create contacts and put them in into a
distribution list. I have modified this to create the contacts in my
own contacts, (not the root default contacts folder). How do I know
create a distribution list in the new contacts folder?
The current code creates the dist list in the root contact folder and a
move is attempted. This just leaves me with two dist lists which are
both empty.
Thanks in advance.
Neil
**START CODE**
var objOutlook = new ActiveXObject("Outlook.Application")
var objOutlookMsg =
objOutlook.CreateItemFromTemplate(this.templatePath);
var objTempItem = objOutlook.CreateItem(olMailItem);
var objContact
var objRecipients = objTempItem.Recipients;
var objDistList = objOutlook.CreateItem(olDistributionListItem);
objDistList.DLName = GROUPNAME;
var objNamespace = objOutlook.GetNamespace('MAPI');
var objFolder = objNamespace.GetDefaultFolder(olFolderContacts);
var objNewFolder = objFolder.Folders.Add(GROUPNAME);
var objContact = objNewFolder.items.add();
//objDistList.parent = objNewFolder;
//var objDistList = objNewFolder.Folders.add('test',
olDistributionListItem);
var record;
var email;
var objContact;
for (var i=0;i<nodeList.length;i++)
{
record = nodeList;
email = record.getAttribute('emailaddress');
//objContact = objOutlook.CreateItem(olContactItem);
//objContact = objNewFolder.items.add();
objContact.email1address = email;
objContact.FileAs = objContact.email1address;
objContact.Save();
objRecipients.add(objContact.email1address);
}
objRecipients.ResolveAll();
objDistList.AddMembers(objRecipients);
objDistList.Save();
objOutlookMsg.Subject = this.subject;
//objOutlookMsg.Body =
objOutlookMsg.Importance = olImportanceNormal;
var objRecipient = objOutlookMsg.Recipients.Add(objDistList.DLName);
objRecipient.Type = olBCC;
objRecipient.Resolve();
objOutlookMsg.Save(); //Save mail to draft folder. You can call
save method to send the email
**END CODE**
I have successfully managed to create contacts and put them in into a
distribution list. I have modified this to create the contacts in my
own contacts, (not the root default contacts folder). How do I know
create a distribution list in the new contacts folder?
The current code creates the dist list in the root contact folder and a
move is attempted. This just leaves me with two dist lists which are
both empty.
Thanks in advance.
Neil
**START CODE**
var objOutlook = new ActiveXObject("Outlook.Application")
var objOutlookMsg =
objOutlook.CreateItemFromTemplate(this.templatePath);
var objTempItem = objOutlook.CreateItem(olMailItem);
var objContact
var objRecipients = objTempItem.Recipients;
var objDistList = objOutlook.CreateItem(olDistributionListItem);
objDistList.DLName = GROUPNAME;
var objNamespace = objOutlook.GetNamespace('MAPI');
var objFolder = objNamespace.GetDefaultFolder(olFolderContacts);
var objNewFolder = objFolder.Folders.Add(GROUPNAME);
var objContact = objNewFolder.items.add();
//objDistList.parent = objNewFolder;
//var objDistList = objNewFolder.Folders.add('test',
olDistributionListItem);
var record;
var email;
var objContact;
for (var i=0;i<nodeList.length;i++)
{
record = nodeList;
email = record.getAttribute('emailaddress');
//objContact = objOutlook.CreateItem(olContactItem);
//objContact = objNewFolder.items.add();
objContact.email1address = email;
objContact.FileAs = objContact.email1address;
objContact.Save();
objRecipients.add(objContact.email1address);
}
objRecipients.ResolveAll();
objDistList.AddMembers(objRecipients);
objDistList.Save();
objOutlookMsg.Subject = this.subject;
//objOutlookMsg.Body =
objOutlookMsg.Importance = olImportanceNormal;
var objRecipient = objOutlookMsg.Recipients.Add(objDistList.DLName);
objRecipient.Type = olBCC;
objRecipient.Resolve();
objOutlookMsg.Save(); //Save mail to draft folder. You can call
save method to send the email
**END CODE**