首页 | 邮件资讯 | 技术教程 | 解决方案 | 产品评测 | 邮件人才 | 邮件博客 | 邮件系统论坛 | 软件下载 | 邮件周刊 | 热点专题 | 工具
网络技术 | 操作系统 | 邮件系统 | 客户端 | 电子邮箱 | 反垃圾邮件 | 邮件安全 | 邮件营销 | 移动电邮 | 邮件软件下载 | 电子书下载

邮件服务器

技术前沿 | Qmail | IMail | MDaemon | Exchange | Domino | 其它 | Foxmail | James | Kerio | JavaMail | WinMail | Sendmail | Postfix | Winwebmail | Merak | CMailServer | 邮件与开发 | 金笛 |
首页 > 邮件服务器 > Lotus Domino > 使用LotusScript获得群组中的用户列表 > 正文

使用LotusScript获得群组中的用户列表

出处:ibm 作者:Prasad KL 时间:2005-8-15 15:19:00

Declarations

Dim count As Integer
Dim persons List As String
Dim groups List
Dim tg As Integer
Dim xy As Integer


Sub Initialize
'The advantate of this code is that we can process any nested groups without any size limitaions.
Dim session As New notessession
Dim ws As New notesuiworkspace
Dim uidoc As NotesUIDocument

Dim db As notesdatabase
Dim namesdb As notesdatabase
Dim groupdoc As notesdocument
Dim groupview As notesview
Dim insidegroupdoc As notesdocument
Dim insidegroups As notesview
Dim doc As notesdocument
Dim curview As notesview
Dim newlist List

Set db=session.CurrentDatabase
Set namesdb=session.GetDatabase(db.Server,"names.nsf")
Set groupview=namesdb.GetView("($Users)")
Set insidegroups=namesdb.getview("($VIMGroups)")
Set curview=db.getview("second")
Set uidoc=ws.CurrentDocument

Set doc=curview.getfirstdocument 'you can set your own doc here. This the backend document for the currently opened uidoc. You can find other alternatives to run this agent.
groupName$ =uidoc.FieldGetText("names") ' Here we are entering the group or person names.

Dim ritem As Variant
Set ritem = doc.GetFirstItem( "all" ) ' Here we are going to store the group extracted people's name

'Call uidoc.FieldSetText("saveoptions","1")
Call uidoc.FieldSetText("Total","") ' Here we will list the total participant list.
Call uidoc.FieldSetText("all","") ' making the field null to print a new value.
Call uidoc.Save
Call uidoc.reload
Call uidoc.save

Forall entry In doc.names
gtype=group(entry) 'Checking whether the entry is a group or People.
If gtype="Group" Then
tg=tg+1
groups(tg)=entry
Else
Call addtolist(entry) ' If entry is a person, then adding to a list called People.
End If
End Forall



'now we have got two lists one is person and another one is group
'This loop will returns you a list in the people's view. and remove the each group entry after processing.
xy=0
Do Until xy = tg
xy=xy+1
et=groupget(groupview,groups(xy))
Erase groups(xy)
Loop

If ( ritem.Type <> RICHTEXT ) Then
Exit Sub
End If

'Iam adding the list to another array, because iam not getting the list with unique values. You can try some other code if you can retruns the list as unique
Dim nar() As String
Forall nvals In Persons
newcount=newcount+1
Redim Preserve nar(newcount)
nar(newcount)=Persons(newcount)
End Forall

'Then make the array as unique
finarray=Arrayunique(nar,0)

'Now print the values one by one in an array. See if you want to process the contents of this rtfield.
' Use the item.values and split the values using newline. So you will get an array.

Forall fins In finarray
If fins <> "" Then
fin=fin+1
Call ritem.Appendtext(fins)
Call ritem.addnewline(1)
End If
End Forall


'This code will close the doc without saving and re-open it.
Call doc.ReplaceItemValue("Total",Cstr(fin))
Call doc.save(True,True)
doc.saveoptions="0"
Call uidoc.close
Call ws.EditDocument(False,doc)
'You can use the notesname class to format the contents and use the evaluate to sort the contents. The code you can get it from my 'Other agent in the same db.
End Sub


Function group(entry As Variant) As String
'Getting first 3 characters will give u an idea whether it is a group or person. In our case every user will have a heirarhical name. In your case you can use ur own code to get this info.
If Left(entry,3)="CN=" Then
group="Person"
Else
group="Group"
End If
End Function


Function addtolist(entry As Variant)
count=count+1
If Isarray(entry) Then ' In some rare cases by mistake or so we have two entries in a document. So run this check before proceed.
Forall ad In entry
persons(count)=ad
End Forall
Else
persons(count)=entry
End If
End Function


Function groupget(gview As notesview,entry As Variant) As String
'here first we are getting group name. Then get the group document and get the members for the group. Then add the person entries to Person array.
'Rest group entries will add to group list.

Set groupdoc=gview.GetDocumentByKey(entry,True)
If Not groupdoc Is Nothing Then
allentries=groupdoc.GetItemValue("members")
Forall ent In allentries
'Set pdoc=gview.GetDocumentByKey(entry,True)
If Left(ent,3)="CN=" Then
count=count+1
persons(count)=ent
Else
tg=tg+1
groups(tg)=ent
ab=ab+1
End If
End Forall
End If
End Function

,
相关文章 热门文章
  • IBM Lotus Domino iCalendar邮件地址解析栈溢出漏洞
  • IBM Lotus Notes Traveler多个安全漏洞
  • IBM Lotus Mobile Connect跨站脚本执行漏洞
  • 现有 IBM Lotus Domino/Notes 邮件模板简介
  • 在 Lotus Notes 中设置邮件定时发送的方法及代理功能介绍
  • IBM Lotus Connections多个安全漏洞
  • IBM Lotus Notes SURunAs.exe明文存储口令漏洞
  • IBM Lotus Domino 8.5 服务器管理入门手册
  • IBM Lotus Notes names.nsf开放重新定向漏洞
  • IBM Lotus Domino LDAP请求远程堆溢出漏洞
  • IBM Lotus Domino readme.nsf页面远程跨站脚本漏洞
  • IBM Lotus Notes远程栈溢出漏洞
  • Domino管理员29个问题
  • Lotus Domino/Notes如何有效防止垃圾邮件
  • 配置Domino服务器
  • Lotus Notes常见问题答疑
  • Lotus Notes安装和使用的常见问题
  • Lotus Notes 的最终用户最需知道的十件事
  • 如何提高Domino服务器性能
  • LOTUS NOTES .INI文件参数设置秘籍
  • Domino 做Internet企业邮局的配置
  • Domino SMTP邮件服务器设置实例
  • 基于Linux平台的Domino Server安装与配置
  • 如何配制Domino for IIS?
  • 自由广告区
     
    最新软件下载
  • SharePoint Server 2010 部署文档
  • Exchange 2010 RTM升级至SP1 教程
  • Exchange 2010 OWA下RBAC实现的组功能...
  • Lync Server 2010 Standard Edition 标..
  • Lync Server 2010 Enterprise Edition...
  • Forefront Endpoint Protection 2010 ...
  • Lync Server 2010 Edge 服务器部署文档
  • 《Exchange 2003专家指南》
  • Mastering Hyper-V Deployment
  • Windows Server 2008 R2 Hyper-V
  • Microsoft Lync Server 2010 Unleashed
  • Windows Server 2008 R2 Unleashed
  • 今日邮件技术文章
  • 腾讯,在创新中演绎互联网“进化论”
  • 华科人 张小龙 (中国第二代程序员 QQ...
  • 微软推出新功能 提高Hotmail密码安全性
  • 快压技巧分享:秒传邮件超大附件
  • 不容忽视的邮件营销数据分析过程中的算..
  • 国内手机邮箱的现状与未来发展——访尚..
  • 易观数据:2011Q2中国手机邮箱市场收入..
  • 穿越时空的爱恋 QQ邮箱音视频及贺卡邮件
  • Hotmail新功能:“我的朋友可能被黑了”
  • 入侵邻居网络发骚扰邮件 美国男子被重..
  • 网易邮箱莫子睿:《非你莫属》招聘多过..
  • 中国电信推广189邮箱绿色账单
  • 最新专题
  • 鸟哥的Linux私房菜之Mail服务器
  • Exchange Server 2010技术专题
  • Windows 7 技术专题
  • Sendmail 邮件系统配置
  • 组建Exchange 2003邮件系统
  • Windows Server 2008 专题
  • ORF 反垃圾邮件系统
  • Exchange Server 2007 专题
  • ISA Server 2006 教程专题
  • Windows Vista 技术专题
  • “黑莓”(BlackBerry)专题
  • Apache James 专题
  • 分类导航
    邮件新闻资讯:
    IT业界 | 邮件服务器 | 邮件趣闻 | 移动电邮
    电子邮箱 | 反垃圾邮件|邮件客户端|网络安全
    行业数据 | 邮件人物 | 网站公告 | 行业法规
    网络技术:
    邮件原理 | 网络协议 | 网络管理 | 传输介质
    线路接入 | 路由接口 | 邮件存储 | 华为3Com
    CISCO技术 | 网络与服务器硬件
    操作系统:
    Windows 9X | Linux&Uinx | Windows NT
    Windows Vista | FreeBSD | 其它操作系统
    邮件服务器:
    程序与开发 | Exchange | Qmail | Postfix
    Sendmail | MDaemon | Domino | Foxmail
    KerioMail | JavaMail | Winwebmail |James
    Merak&VisNetic | CMailServer | WinMail
    金笛邮件系统 | 其它 |
    反垃圾邮件:
    综述| 客户端反垃圾邮件|服务器端反垃圾邮件
    邮件客户端软件:
    Outlook | Foxmail | DreamMail| KooMail
    The bat | 雷鸟 | Eudora |Becky! |Pegasus
    IncrediMail |其它
    电子邮箱: 个人邮箱 | 企业邮箱 |Gmail
    移动电子邮件:服务器 | 客户端 | 技术前沿
    邮件网络安全:
    软件漏洞 | 安全知识 | 病毒公告 |防火墙
    攻防技术 | 病毒查杀| ISA | 数字签名
    邮件营销:
    Email营销 | 网络营销 | 营销技巧 |营销案例
    邮件人才:招聘 | 职场 | 培训 | 指南 | 职场
    解决方案:
    邮件系统|反垃圾邮件 |安全 |移动电邮 |招标
    产品评测:
    邮件系统 |反垃圾邮件 |邮箱 |安全 |客户端
    广告联系 | 合作联系 | 关于我们 | 联系我们 | 繁體中文
    版权所有:邮件技术资讯网©2003-2010 www.5dmail.net, All Rights Reserved
    www.5Dmail.net Web Team   粤ICP备05009143号