N
nYssa
Hi,
I have a custom appointment outlook form, and I am wanting to pop up a
message if a resource is invited to the appointment. I have the code
to check whether a resource has been invited:
Function RecipCountNoResource()
Dim objRecip
Dim intCount
Const olResource = 3
intCount = 0
Set colRecips = Item.Recipients
For Each objRecip In Item.Recipients
If objRecip.Type <> olResource Then
intCount = intCount + 1
End If
Next
RecipCountNoResource = intCount
Set objRecip = Nothing
End Function
HOWERVER: What I want to do is to check if the resource that is
invited
belongs to a particular group. I have been told that the only way to
do this
is creating a MAPI session in order to get the username. But I haven't
been
able to find enough information to do it. Once I have the code to get
the
username based on the recipient, then I can check if it is a
particular
group, which I can do using the following code:
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
strDomain = "mydomain.com"
strUser = "nmillin"
Set oUser = GetObject("WinNT://" & strDomain & "/" & strUser)
If MemberOf("Solutions", oUser) = true then
If objRecip
intCount = intCount + 1
End If
End If
However at the moment the user name is hard coded. So my question is
again,
how do I get a recipients username (ie. jbloggs) using CDO/MAPI.
I have a custom appointment outlook form, and I am wanting to pop up a
message if a resource is invited to the appointment. I have the code
to check whether a resource has been invited:
Function RecipCountNoResource()
Dim objRecip
Dim intCount
Const olResource = 3
intCount = 0
Set colRecips = Item.Recipients
For Each objRecip In Item.Recipients
If objRecip.Type <> olResource Then
intCount = intCount + 1
End If
Next
RecipCountNoResource = intCount
Set objRecip = Nothing
End Function
HOWERVER: What I want to do is to check if the resource that is
invited
belongs to a particular group. I have been told that the only way to
do this
is creating a MAPI session in order to get the username. But I haven't
been
able to find enough information to do it. Once I have the code to get
the
username based on the recipient, then I can check if it is a
particular
group, which I can do using the following code:
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
strDomain = "mydomain.com"
strUser = "nmillin"
Set oUser = GetObject("WinNT://" & strDomain & "/" & strUser)
If MemberOf("Solutions", oUser) = true then
If objRecip
intCount = intCount + 1
End If
End If
However at the moment the user name is hard coded. So my question is
again,
how do I get a recipients username (ie. jbloggs) using CDO/MAPI.