Your application can use the Microsoft System Center Configuration Manager 2007 management point interface messages to communicate with a Configuration Manager 2007 management point for:

This topic provides simple instructions for using the management point interface to send messages using .NET Framework.

Creating a .NET Framework Wrapper for the COM Binary

You can use the Type Library Importer tool (Tlbimp.exe) to import COM types into native .NET Framework types without having to make PInvoke calls in your application.

  1. To get the type libraries, install the Configuration Manager 2007 SDK.

  2. Open a command window and navigate to the folder where Smsmsgapi.tlb is located, usually <SDKFOLDER>\Samples\Management Point API.

  3. At the command prompt, run Tlbimp.exe using the following command: tlbimp smsmsgapi.tlb /out:SmsMsgApiNet.dll.

  4. Ensure that the file SmsMsgApiNet.dll is created in the folder containing the Smsmsgapi.tlb file.

Correcting Type Library Importer Tool for Pointers

Currently, the Type Library Importer tool (Tlbimp.exe) converts pointers to arrays as single items by reference. To adjust for this situation, you must disassemble SmsMsgApiNet.dll and reassemble the binary with the correct data type.

  1. At the command prompt, run the following command to decompile the binary: ildasm SmsMsgApiNet.dll /

  2. Using Visual Studio or equivalent, open the file and look for the following code:

      Copy Code
    method public hidebysig newslot abstract virtual instance void  SetClientCertificate(
    [in] valuetype SmsMsgApiNet.MPAPI_CERT_STORE_LOCATION StoreLocation,
    [in] string  marshal( lpwstr) szStoreName, 
    [in] uint8& pCertHashBlob) runtime managed internalcall
  3. The uint8& data type for the pCertHashBlob parameter is incorrect for an array. Change the data type to uint8*, and save and close the file.

    The uint8& data type is used incorrectly in other places in the file, but these instructions focus on the critical instance for simplicity. For your application, it might be necessary to replace other instances of the data type.
  4. At the command prompt, run the following command to recompile the decompiled and modified binary into a DLL with the corrected parameter(s): ilasm /DLL /OUTPUT=SmsMsgApiNet.dll

Preparing the Project

To use the objects, you must create a Visual Studio project.

  1. Use Visual Studio to add the SmsMsgApiNet.dll binary as a reference in the project.

  2. You now need to register the COM binary with Windows so that the operating system can create the management point interface. To do this, navigate to the folder containing SmsMsgApi.dll and run the following command: regsvr32 SmsMsgApi.dll

Creating the First Message

With the COM binary references using the custom wrapper in Visual Studio or equivalent, you can create a simple message to send to the management point. Because the SDK uses COM to handle memory, your application must use the ISmsMessaging::CreateMessage Method to create the message object so that it can pass over memory boundaries. The following is a code example:

  Copy Code
SmsMessagingClass messaging = new SmsMessagingClass();
ISmsMessage4 message, reply;
smsMessaging.CreateMessage(out message);
// Send the message using HTTP 
messaging.Invoke("http://myHostname", message, out reply); 
// Do something with the reply here...

See Also

Send comments about this topic to Microsoft.