ossAdmin
asked on
VBScript: Error while creating distribution list in Outlook
Hello experts,
We need to create a distribution list in Outlook from a VBScript.
When the number of email addresses to add in the list is small (<90), everytihing is working well.
But when this number approaches 100, we get an error 80004004 and the process is aborted.
According to our tests, the number of addresses from which we have an error is not fixed.
And it seems the error is more related to the total size (in character) of the whole list than to the number of addresses we try to put in this list.
This is the code used to create the list:
Do you have any idee of how to avoid this error?
For your info, the script is generated/downloaded from a JSP page.
Many thanks in advance for your help.
ossAdmin
We need to create a distribution list in Outlook from a VBScript.
When the number of email addresses to add in the list is small (<90), everytihing is working well.
But when this number approaches 100, we get an error 80004004 and the process is aborted.
According to our tests, the number of addresses from which we have an error is not fixed.
And it seems the error is more related to the total size (in character) of the whole list than to the number of addresses we try to put in this list.
This is the code used to create the list:
Dim myOlApp, myDistList, myMailItem, myRecipients
Set myOlApp = WScript.CreateObject("Outlook.Application")
Set myDistList = myOlApp.CreateItem(7)
myDistList.DLName = InputBox("Enter the name of the new distribution list.")
Set myMailItem = myOlApp.CreateItem(0)
Set myRecipients = myMailItem.Recipients
myRecipients.Add "address1@gmail.com"
myRecipients.Add "address2@gmail.com"
myRecipients.Add "address3@gmail.com"
...
myRecipients.Add "lastaddress@gmail.com"
myRecipients.ResolveAll
myDistList.AddMembers myRecipients
myDistList.Save
myDistList.Display
The error is occuring on the "myDistList.Save" instruction.Do you have any idee of how to avoid this error?
For your info, the script is generated/downloaded from a JSP page.
Many thanks in advance for your help.
ossAdmin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello matthewspatrick,
I've closed this question too soon...
I've been trying to implement the sub-lists solution you proposed, as well as several variants without success.
The result is always the same: the sub-lists are well created, but the main list remains empty.
Could you please explain how you've manage to make it work?
Many thanks in advance.
ossAdmin.
I've closed this question too soon...
I've been trying to implement the sub-lists solution you proposed, as well as several variants without success.
The result is always the same: the sub-lists are well created, but the main list remains empty.
Could you please explain how you've manage to make it work?
Many thanks in advance.
ossAdmin.
ASKER
Thanks a lot for your reply.
Yesterday I indeed found the same information here. The information in this link is not 100% correct (I'm running Outlook SP3 and still have the size limitation).
Your proposal is I think the best (and only?) solution to this issue. And I hope our users will accept it (which is another story...).
Many thanks again.
ossAdmin.