HostedEmailProtectedDataStore Constructor (Guid, Byte[])
Creates a new instance of the HostedEmailProtectedDataStore object, using the specified data store properties.
Namespace: Microsoft.WindowsServerSolutions.HostedEmail
Assembly: Wssg.HostedEmailBase (in Wssg.HostedEmailBase.dll)
Syntax
public HostedEmailProtectedDataStore(
Guid addinIdentity,
byte[] optionalEntropy
)
public:
HostedEmailProtectedDataStore(
Guid addinIdentity,
array<unsigned char>^ optionalEntropy
)
Public Sub New (
addinIdentity As Guid,
optionalEntropy As Byte()
)
Parameters
addinIdentity
Type: System.GuidThe GUID that identifies a specific hosted email adapter.
optionalEntropy
Type: System.Byte[]The optional entropy for protecting the stored data.
Exceptions
Exception | Condition |
---|---|
ArgumentException | The addinGuid is {00000000-0000-0000-0000-000000000000} |
Remarks
The data type of the Item property is string only. The reason for this is that the encryption and decryption algorithms are designed to work only on strings.
Examples
The following code describes how to use the protected data store constructor. For the complete code sample, see Quickstart: Creating a Hosted Email Adapter
internal static class CredentialManager
{
private const string adminUserNameKey = "adminUserName";
private const string adminPasswordKey = "adminPassword";
// This is copied from ContosoHostedEmail.addin
private const string addinId = "3983E9AC-B6D1-4A2A-881C-4B1CEFCA5266";
// The following line is the result of executing the code 'Encoding.Unicode.GetBytes("P@ssw0rd");'
static byte[] optionalEntropy = new byte[] { 80, 0, 64, 0, 115, 0, 115, 0, 119, 0, 48, 0, 114, 0, 100, 0 };
static HostedEmailProtectedDataStore store = new HostedEmailProtectedDataStore(Guid.Parse(addinId), optionalEntropy);
public static string AdminUserName
{
get
{
return store[adminUserNameKey];
}
set
{
store[adminUserNameKey] = value;
}
}
public static string AdminPassword
{
get
{
return store[adminPasswordKey];
}
set
{
store[adminPasswordKey] = value;
}
}
public static void ClearAll()
{
if (store != null) store.Destroy();
}
}
See Also
HostedEmailProtectedDataStore Class
Microsoft.WindowsServerSolutions.HostedEmail Namespace
Return to top