Outlook add-in 插件.Net开发经验-补充(2.1)

王朝c#·作者佚名  2006-01-08
宽屏版  字体: |||超大  

这里上传文件字数太少,只能分多次。

1. 在outlook里创建Menu, Button。

在outlook里创建Menu, Button。

Private m_oMainMenu As Office.CommandBarPopup

Private WithEvents mnuLogInOff As Office.CommandBarButton

Dim oBars As Office.CommandBars

Dim oMenuBar As Office.CommandBar

'添加及选择工具栏

oBars = m_olExplorer.CommandBars '取所有菜单栏

oMenuBar = oBars.ActiveMenuBar '取当前菜单栏

'添加主菜单

m_oMainMenu = CType(oMenuBar.Controls.Add(10, , , ,True),Office.CommandBarPopup)

m_oMainMenu.Caption = "MainMenu"

'添加菜单项

mnuLogInOff = CType(m_oMainMenu.Controls.Add(Type:=1), Office.CommandBarButton) ', Temporary:=True, Before:=1)

mnuLogInOff.Caption = " mnuLogInOff"

mnuLogInOff.Enabled = True

2. 创建,修改Folder view。

创建,修改Folder view。

Folder view 是xml格式。

Dim myView As myOutlook.View

Dim myViews As myOutlook.Views

myViews = g_oBaseFolder.Views

myView = myViews.Add(Name:="Normal View", _ ViewType:=myOutlook.OlViewType.olTableView, SaveOption:=myOutlook.OlViewSaveOption.olViewSaveOptionAllFoldersOfType)

myView.XML = sViewXML

myView.Save()

3. 修改类别 category。

category信息,存放在注册表内。

'**********************************

'增加,修改category,调试

'**********************************

Private Sub mnuDebug2_Click(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean) Handles mnuDebug2.Click

Dim sSubkey As String

Dim sValueName As String

Dim oValue As Object

sSubkey = "Software\Microsoft\Office\10.0\Outlook\Categories"

sValueName = "MasterList"

oValue = GetRegisterValue(sSubkey, sValueName, modOutlook.RegTypeEnum.RegBinaryType)

Dim sOldCategories As String

sOldCategories = GetRegisterValue(sSubkey, sValueName, modOutlook.RegTypeEnum.RegBinaryType)

Dim sNewCategories As String

sNewCategories = InputBox("Please input new categories,use;split", "Input", sOldCategories)

' sNewCategories = "custom;VIP;策略;等待;电话;个人;供应商;观点;国际;贺卡;假日;竞争;礼物;目标/目的;商务;时间和经费;收藏夹;熟人;杂项"

sNewCategories = Trim(sNewCategories)

If Right(sNewCategories, 1) = ";" Then

sNewCategories = Trim(Left(sNewCategories, sNewCategories.Length - 1))

End If

oValue = EncodeChineseString2Unicode(sNewCategories)

SetRegisterValue(sSubkey, sValueName, oValue)

MsgBox(sNewCategories, MsgBoxStyle.Information)

End Sub

Category在注册表里是byte[]保存

4. 得到最新添加的pst store的folder。

得到最新添加的pst store的folder

m_olNamespace.AddStore(sStorePath)

oPstFolder = m_olNamespace.Folders.GetLast

m_sStoreID = oPstFolder.StoreID

DebugWriter("StoreID: ", m_sStoreID)

#Region "调试所用的函数,可以调试输出,或输出文件"

Public Sub DebugWriter(ByVal strSource As String, Optional ByVal strMessage As String = "")

#If constDebug Then

Dim tempPath As String = Path.GetTempPath()

'Dim tempPath As String = "C:\"

Dim myFile As New StreamWriter(tempPath & "debug.txt", True)

Try

Dim strError As String = Now().ToString & Chr(9) & strSource & Chr(9) & strMessage

myFile.WriteLine(strError)

Finally

myFile.Close()

End Try

#Else

Debug.WriteLine(strSource & Chr(9) & strMessage)

#End If

End Sub

#End Region

5. 做某些操作会出现outlook得安全警告,例如:发送邮件,查询address ……

看看这些:

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q290/4/99.asp&NoWebContent=1

http://www.microsoft.com/china/msdn/library/dnout2k2/html/odc_olsecurityovw.asp#odc_olsecurityovw_topic7

6. 先写到这里,想到了再补充

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有