Microsoft Information Protection SDK - MipContext object concepts

MipContext

MipContext is the highest level object in the SDK. It's responsible for managing state across all profiles created as part of an application or service. It also handles releasing MIP SDK resources after the MipContext object is destroyed.

Important

Only a single MipContext per process is permitted. Creating more than one might result in unexpected behavior. MipContext should be created at app start, and the same MipContext used for the lifetime of the application.

After you create a mip::MipContext object, you can use it to create mip::FileProfile, mip::PolicyProfile, or mip::ProtectionProfile objects.

Creating MipConfiguration

The mip::MipConfiguration class allows the application to set various application-wide configuration settings for MIP SDK. These settings include:

  • Application Info: Name, Application ID, Version
  • Storage directory for logs and cache
  • Logging level
  • Offline mode
  • Feature flighting settings
  • Delegates, including logging, storage, HTTP, JSON parsing, and XML parsing.
  • Diagnostic configuration
std::shared_ptr<mip::MipConfiguration> mipConfiguration = std::make_shared<mip::MipConfiguration>(mAppInfo,
				"mip_data",
				mip::LogLevel::Trace,
				false);
MipConfiguration mipConfiguration = new MipConfiguration(appInfo, "mip_data", LogLevel.Trace, false);

After you initialize MipConfiguration, you can use it to create the MipContext object.

Creating MipContext

Call the MipContext::Create() function with the provided MipConfiguration object to create the MipContext.

std::shared_ptr<mip::MipContext> mMipContext = mip::MipContext::Create(mipConfiguration);
MipContext = mipContext = MIP.CreateMipContext(mipConfiguration);

After you create the MipContext object, you can use it to create FileProfile, PolicyProfile, or ProtectionProfile objects, depending on which SDK your application uses.

Shutting down

Properly destroying all MIP SDK objects requires shutting down MipContext. To do so, call the Shutdown function. The MipContext destructor also calls MipContext.Shutdown() when the MipContext object is destroyed.

Next steps