本文整理汇总了C++中zimbra::util::ScopedInterface::SetPassword方法的典型用法代码示例。如果您正苦于以下问题:C++ ScopedInterface::SetPassword方法的具体用法?C++ ScopedInterface::SetPassword怎么用?C++ ScopedInterface::SetPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zimbra::util::ScopedInterface
的用法示例。
在下文中一共展示了ScopedInterface::SetPassword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateExchangeMailBox
//.........这里部分代码省略.........
throw ExchangeAdminException(hr, L"CreateExchangeMailBox(): QueryInterface Failed.",
ERR_CREATE_EXCHMBX, __LINE__, __FILE__);
CComVariant varProp;
varProp.Clear();
// set samAccount
varProp = lpwstrNewUser;
if (FAILED(hr = pIADNewUser->Put(CComBSTR(L"sAMAccountName"), varProp)))
throw ExchangeAdminException(hr,L"CreateExchangeMailBox(): Put(sAMAccountName) Failed.",
ERR_CREATE_EXCHMBX, __LINE__, __FILE__);
if(FAILED(hr = pIADNewUser->SetInfo()))
throw ExchangeAdminException(hr,L"CreateExchangeMailBox(): Put(sAMAccountName) Failed.",
ERR_CREATE_EXCHMBX, __LINE__, __FILE__);
// set userAccountControl
varProp.Clear();
hr = pIADNewUser->Get(CComBSTR(L"userAccountControl"), &varProp);
varProp = varProp.lVal & ~(ADS_UF_ACCOUNTDISABLE);
if (FAILED(hr = pIADNewUser->Put(CComBSTR(L"userAccountControl"), varProp)))
throw ExchangeAdminException(hr,L"CreateExchangeMailBox(): Put(userAccountControl) Failed.",
ERR_CREATE_EXCHMBX, __LINE__, __FILE__);
if(FAILED(hr = pIADNewUser->SetInfo()))
ThrowSetInfoException(hr, L"SetInfo - Put(userAccountControl) Failed.");
// set Account enabled
if (FAILED(hr = pIADNewUser->put_AccountDisabled(VARIANT_FALSE)))
{
throw
ExchangeAdminException(hr, L"CreateExchangeMailBox(): put_AccountDisabled Failed.",
ERR_CREATE_EXCHMBX, __LINE__, __FILE__);
}
if(FAILED(hr = pIADNewUser->SetInfo()))
ThrowSetInfoException(hr, L"SetInfo - put_AccountDisabled Failed.");
// set password
if (FAILED(hr = pIADNewUser->SetPassword(CComBSTR(lpwstrNewUserPwd))))
{
throw
ExchangeAdminException(hr, L"CreateExchangeMailBox(): SetPassword Failed.",
ERR_CREATE_EXCHMBX, __LINE__, __FILE__);
}
if(FAILED(hr = pIADNewUser->SetInfo()))
ThrowSetInfoException(hr, L"SetInfo - SetPassword Failed.");
// user account password does not expire
varProp.Clear();
VARIANT var;
VariantInit(&var);
if (!FAILED(hr = pIADNewUser->Get(CComBSTR(L"userAccountControl"), &var)))
{
V_I4(&var) |= ADS_UF_DONT_EXPIRE_PASSWD;
if (FAILED(hr = pIADNewUser->Put(CComBSTR(L"userAccountControl"), var)))
{
throw ExchangeAdminException(hr,L"CreateExchangeMailBox(): Put(userAccountControl) Failed.",
ERR_CREATE_EXCHMBX, __LINE__, __FILE__);
}
}
if(FAILED(hr = pIADNewUser->SetInfo()))
ThrowSetInfoException(hr, L"SetInfo - userAccountControl Failed.");
varProp.Clear();
// set the homeMDB;
if (!strLogonHomeMDB.empty())
{
varProp = strLogonHomeMDB.c_str();
if (FAILED(hr = pIADNewUser->Put(CComBSTR("homeMDB"), varProp)))
throw ExchangeAdminException(hr, L"CreateExchangeMailBox(): Put(homeMDB) Failed.",
ERR_CREATE_EXCHMBX, __LINE__, __FILE__);