![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Can someone tell me if this looks correct?
---------------------------------------------------- On Error Resume Next Const olDistributionListItem = 10 Set objOutlook = CreateObject("Outlook.Application") Set objNamespace = objOutlook.GetNamespace("MAPI") Set objFolder = objNamespace.GetDefaultFolder(olDistributionListIt em) Dim i As Integer Dim objRecip As Outlook.Recipient For i = objDL.MemberCount To 1 Step -1 Set objRecip = objDL.GetMember(i) objDL.RemoveMember objRecip Next MsgBox objDL.MemberCount Set objRecip = Nothing Set objList = objFolder.Items("Math Teachers") Set objGroup = GetObject("LDAP://[fill in your path here]CN=Finance Users,OU=Finance,,DC=fabrikam,DC=com") For Each strUser in objGroup.Member Set objUser = GetObject("LDAP://" & strUser) strUserName = objUser.displayName Set objRecipient = objOutlook.Session.CreateRecipient(strUserName) objRecipient.Resolve objList.AddMember objRecipient Next Set objOutlook = CreateObject("Outlook.Application") Set objNamespace = objOutlook.GetNamespace("MAPI") Set objFolder = objNamespace.GetDefaultFolder(olDistributionListIt em) Dim i As Integer Dim objRecip As Outlook.Recipient For i = objDL.MemberCount To 1 Step -1 Set objRecip = objDL.GetMember(i) objDL.RemoveMember objRecip Next MsgBox objDL.MemberCount Set objRecip = Nothing Set objList = objFolder.Items("Science Teachers") Set objGroup = GetObject("LDAP://[fill in your path here]CN=Finance Users,OU=Finance,,DC=fabrikam,DC=com") For Each strUser in objGroup.Member Set objUser = GetObject("LDAP://" & strUser) strUserName = objUser.displayName Set objRecipient = objOutlook.Session.CreateRecipient(strUserName) objRecipient.Resolve objList.AddMember objRecipient Next wscript.quit |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlk 2k3 Script: Saving Excel File programticaly from OUTLOOK SCRIPT | news.microsoft.com | Outlook and VBA | 3 | November 22nd 06 04:33 PM |
Run A SCRIPT - Select Script EMPTY | mitupan116 | Outlook and VBA | 1 | November 2nd 06 10:36 PM |
Recommended location for future proof contact lists and calendars? | Carol Chisholm | Outlook - Using Contacts | 2 | June 17th 06 03:35 PM |
Rule 'run a script' not running my script | [email protected] | Outlook and VBA | 3 | May 30th 06 01:09 PM |
Proof of concept question for Outlook customization | [email protected] | Outlook - Using Forms | 1 | February 2nd 06 12:41 AM |