PIA Outlook Office library
I am having simple question.
I installed PIA Office 15.0 for outllook and gave reference in my winform .net application.
I just wanted to know if I deploy this application on machine which is having lower version of outlook(eg outlook 2007/2010) will my application work properly?
Sorry it is 14.0 outlook PIA refernece given by me to my app. and code is
` Dim OutlookMessage As outlook.MailItem Dim AppOutlook As New outlook.Application Try Dim oApp As Microsoft.Office.Interop.Outlook._Application oApp = New Microsoft.Office.Interop.Outlook.Application
Dim oMsg As Microsoft.Office.Interop.Outlook._MailItem
oMsg = oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
oMsg.Subject = P_Subj
oMsg.Body = P_Body
oMsg.To = P_To
'oMsg.CC = sCC
If Trim(P_AttachPath) <> "" Then
Dim sBodyLen As Integer = Int(P_Body.Length)
Dim oAttachs As Microsoft.Office.Interop.Outlook.Attachments = oMsg.Attachments
Dim oAttach As Microsoft.Office.Interop.Outlook.Attachment
oAttach = oAttachs.Add(P_AttachPath, , sBodyLen, P_AttachPath)
End If
oMsg.Send()
MsgBox("Mail sent to outlook successfully. ", MsgBoxStyle.Information, "")
oApp = Nothing
oMsg = Nothing '
it is giving error for office 2007.
I'd recommend using PIAs that correspond to the lowest version of Outlook/Office. Thus, you can be sure that you don't use methods and properties introduced in later versions. In general, if you embed interop types (read more below) it will run without issues.
Beginning with the .NET Framework 4, the common language runtime supports embedding type information for COM types directly into managed assemblies, instead of requiring the managed assemblies to obtain type information for COM types from interop assemblies. Because the embedded type information includes only the types and members that are actually used by a managed assembly, two managed assemblies might have very different views of the same COM type. Each managed assembly has a different Type object to represent its view of the COM type. The common language runtime supports type equivalence between these different views for interfaces, structures, enumerations, and delegates. You can read more about that in the Type Equivalence and Embedded Interop Types article in MSDN.
Also see Walkthrough: Embedding Types from Managed Assemblies (C# and Visual Basic).
I have been using the Microsoft Office 2010: Primary Interop Assemblies Redistributable in several of my applications, and I can report that deployment on Windows 8.1/8/7 running Office 2013/2010 is flawless. I have also had some success deploying to XP machines running Office 2003, but this is not guaranteed. The 2010 PIA Redistributable is available for download at http://www.microsoft.com/en-us/download/details.aspx?id=3508
链接地址: http://www.djcxy.com/p/63764.html上一篇: Outlook从文件添加引用
下一篇: PIA Outlook Office库