惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

博客园 - zz

关于c# 静态构造函数的说明 后绑定webservice, 下帖引用自他人 通过citrix client 打印label 标签 如何用正确的方法来写出质量好的软件的体会 [转帖]满分的项目管理 转载 -- Visual Basic.Net中的文件操作 一位买车高手的经验谈 绝对有收藏价值 [转贴 2007-03-27 11:16:10 ] 发表者: 不要复杂 转摘-ComponentArt WebUI3.0控件的使用方法 在德国买手表 转贴 - Dflying Chen @ joycode 微软公司昨天发布的三个与Office System 2007相关的软件和参考文档 我的电脑,我的文件夹都打不开了? 名言哪! sql 常用命令 how to show a dialog box that prompts you to either "Open it" or "Save it to disk"again? sps List中根据利用Today和birth字段,计算用户年龄 用户怎么无法登陆sps网站了? 滚动显示sps站点中某个列表里面的内容的 webpart 我碰到的到现在为止,还没有找到比较好的解决方法的sps问题 download latest 20 SharePoint Portal Site theme
再asp.net中实现sharepoint里面调用outlook address book的功能
zz · 2005-09-23 · via 博客园 - zz

 我们可以利用COM Component  SpreadsheetLauncher和MsSvAbw.AddrBoookWrapper实现再asp.net Webpage中调用outlook 地址簿 

<HEAD>
        
<title>Default</title>
        
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        
<meta name="CODE_LANGUAGE" Content="C#">
        
<meta name="vs_defaultClientScript" content="JavaScript">
        
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
        
<SCRIPT language="VBScript">
            
Function OpenABW()
            
                
'define local variables used in this method
                Dim objAddrBkWrap
                
Dim objContacts
                
Dim objABWOp
                
Dim objContact
                
                
'Initialize variables for the messages displayed to the user during the contact importing process
                const L_NeedSharePointAddrBook_Text = "To import contacts, you must have an Address Book compatible with Windows SharePoint Services and you must have Internet Explorer 5.0 or greater."
                
const L_SelectUsers_Text = "Select Users to Import 选择用户"
                
const L_Add_Text = "Add 添加"
                
                
'Initialize the return value to an be an emptystring
                OpenABW = ""
                
                
'Turn on our simple error handling (which is essentially disabling errors from being raised to the browser)
                On Error Resume Next

                
'Create an instance of the Sharepoint Address Book Import component, which is defined in Msosvabw.dll                
                Set objAddrBkWrap = CreateObject("MsSvAbw.AddrBookWrapper")                


                
If not IsObject(objAddrBkWrap) then
                    
                    
'We don't have a valid object, so tell the user the import couldn't be performed
                    MsgBox L_NeedSharePointAddrBook_Text
                    OpenABW 
= ""

                
Else
                    
                    
'Using the new Sharepoint Address Book Import object, prompt the user to select some entries (Contacts)
                    'which are returned in the objContacts collection variable
                    'objABWOp = objAddrBkWrap.AddressBook(, 1, , , , objContacts, , , True)
                    objABWOp = objAddrBkWrap.AddressBook(L_SelectUsers_Text&""1, L_Add_Text&"""""", objContacts, NothingNothingTrue)
                    
                    
'Display the list of selected Address Book Entries - for debugging purposes                    
                    'call window.alert("objContacts.count: " + cstr(objContacts.count))
                    
                    
'if we have a valid return value from the previous method, then process the selections
                    If objABWOp <> 0 then
                        OpenABW 
= ""
                    
Else
                        
'Process the selected Address Book Entries by iterating through them and building an XML document
                        'containing all of the selected Contacts and their information.  
                        OpenABW = ProcessABWCollection(objContacts)
                    
End If
                        
                
End If

                
'turn off our "On Error Resume Next" error handling
                On Error GoTo 0
            
End Function


            
Function EnsureImport()
                
'This method creates an instance of the SharePoint.SpreadsheetLauncher component to ensure the 
                'presence and availability of the component

                
Dim objEnsureImport

                
'Initialize the return value to false (0)                  
                EnsureImport = 0
                    
                
'Turn on our simple error handling (which is essentially disabling errors from being raised to the browser)
                On Error Resume Next
                    
                
'The Sample in the SDK indicates that you should use the ProgID "SharePoint.SpreadsheetLauncher.1"
                'however, WSS clearly uses the ProgID without specifying the version number.
                'Set objEnsureImport = CreateObject("SharePoint.SpreadsheetLauncher.1")
                Set objEnsureImport = CreateObject("SharePoint.SpreadsheetLauncher")

                
'Return whether or not we can do the import                
                if not IsObject(objEnsureImport) then
                    EnsureImport 
= -1
                
else
                    objEnsureImport.EnsureImport()
                
end if
                    
                
'turn off our "On Error Resume Next" error handling
                On Error GoTo 0
            
End Function
        
</SCRIPT>
        
<SCRIPT language="JavaScript">   
                                                    
            
function btnSelectContacts_Click()
            
{
                ImportFromAddressBook();
            }


            
function ImportFromAddressBook()    
            
{
                
var strXMLContacts = "";
            
                
//Verify that the Sharepoint Address Book (Contact) Import components are installed and available
                if (EnsureImport() == 0)    
                
{
                    
//Now prompt the user to select Address Book Entries and conver their selections into an XML structure
                    strXMLContacts = DoImportFromAddressBook();
                
                        
                        Form1.xmlContacts.value 
= strXMLContacts;
                        Form1.submit();
                }

            }

            
            
function DoImportFromAddressBook()    
            
{
                
//Simple call the OpenABW (ABW - Address Book Wrapper) and return the XML data string containing all of 
                //the data for the selected Address Book Entries (contacts)        
                return OpenABW();            
            }


                
            
function ProcessABWCollection(col)    
            
{
                
try 
                
{
                    
                    
//Define a string array containing a list of all of the Property names for working with a Contact object
                    var rgstProps  = new Array("FirstName""LastName""SMTPAddress""CompanyName""JobTitle""HomeTelephoneNumber"
                        
"BusinessTelephoneNumber""MobileTelephoneNumber""BusinessFaxNumber""BusinessAddressStreet"
                        
"BusinessAddressCity""BusinessAddressState""BusinessAddressPostalCode""BusinessAddressCountry""Body");
                        
                    
//Also, define a string array containing a list of all the Field names for a contact
                    //NOTE:  These could be different values, but the positions of items in this array need to match up 
                    //with the Properties array
                    var rgstFields = new Array("FirstName""Title""Email""Company""JobTitle""HomePhone""WorkPhone""CellPhone"
                        
"WorkFax""WorkAddress""WorkCity""WorkState""WorkZip""WorkCountry""Comments");

                    
//define the member variables for this method
                    var st;
                    
var objContactItem;
                    
var result="";
                            
                    
//Get a new Enumerator object for working with the passed collection of Address Book Entries (contacts)        
                    var e = new Enumerator(col);

                    
//If there were no items selected, then simply return
                    if (e.atEnd())
                    
{            
                        
return "";
                    }

                    
                    
for (; !e.atEnd(); e.moveNext())
                    
{
                        objContactItem 
= e.item();
                        result
=result+objContactItem.SMTPAddress+";";
                    }

                    
return result;
        

                }
        
                
catch (excp) 
                
{
                    window.alert(
"An error occured processing the list of selected Address Book Entries (contacts).");
                    
return null;
                }
        
            }

        
</SCRIPT>
    
</HEAD>
    
<body MS_POSITIONING="GridLayout">
        
<form id="Form1" method="post" runat="server">
            
<asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 72px" runat="server"
                TextMode
="MultiLine" Width="536px" Height="120px"></asp:TextBox>
            
<INPUT id="btnSelectContacts" style="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 16px"
                onclick
="javascript:return btnSelectContacts_Click();" type="button" value="Select Contacts">
            
<INPUT ID="xmlContacts" runat="server" type="hidden" name="xmlContacts" style="Z-INDEX: 103; LEFT: 288px; POSITION: absolute; TOP: 24px">
        
</form>
    
</body>
</HTML>