EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB12090: Is MicroStrategy Office API compatible with VB.Net?


Community Admin

• Strategy


This document explains how to create a VB.NET application using the Strategy Office API. In general, to call Strategy Office from a .NET assembly, a developer must use the Strategy Office .NET assembly as the reference, not the COM type library.
 
The COM type library (Program Files\MicroStrategy\Office\moimain.tlb) is generated by .NET to allow COM applications to call Strategy Office, which a is .NET assembly. Since the type library was generated from an assembly, it can't be used as a COM reference by another .NET application. That is, when attempting to reference the COM type library from a .NET assembly, Visual Studio .NET cannot generate the interop assembly to call COM.
 
A .NET reference needs to be added to the VB.NET application from Program Files\MicroStrategy\Office\moimain.dll, not a COM reference from Program Files\MicroStrategy\Office\moimain.tlb.
 
Below is a VB.NET code snippet that shows how to initialize Strategy Office using the .NET API:
 


Dim office As MSTROfficeInterface.MOIOffice

Dim status As MSTROfficeInterface.EnumMOIErrorStatus

 

office = New MSTROfficeInterface.MOIOffice
 

office.Initialize(Nothing, status)

 

if status = MSTROfficeInterface.EnumMOIErrorStatus.MOISuccess Then
 

MessageBox.Show("Success")

End If

Here's the equivalent in VB using the COM API:
 

Dim office As MOIOffice

Dim status As EnumMOIErrorStatus

 

Set office = New MOIOffice
 

office.Initialize Nothing, status

 

If status = EnumMOIErrorStatus_MOISuccess Then
 

MsgBox "Success"

End if

 
 
 
CUSTOMIZATION WARNING:
This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy Technical Support makes no guarantee that an updated version of this particular customization will be provided. In the event of a code change in future builds, Strategy may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build. For enhancements to this customization or to incorporate similar functionality into other versions, contact your Account Executive to inquire about Strategy Consulting assistance.
 
Third Party Software Installation WARNING
 
The third-party product(s) discussed in this technical note is manufactured by vendors independent of Strategy. Strategy makes no warranty, express, implied or otherwise, regarding this product, including its performance or reliability.


Comment

0 comments

Details

Knowledge Article

Published:

June 7, 2017

Last Updated:

June 7, 2017