Adding the photo in WSP Active Directory users. part 1
This commit is contained in:
parent
2d1d464c43
commit
642890f4dc
5 changed files with 136 additions and 1 deletions
|
@ -768,8 +768,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
return ExchangeServerController.SetExchangeAccountDisclaimerId(itemId, AccountID, ExchangeDisclaimerId);
|
||||
}
|
||||
[WebMethod]
|
||||
|
||||
[WebMethod]
|
||||
public int GetExchangeAccountDisclaimerId(int itemId, int AccountID)
|
||||
{
|
||||
return ExchangeServerController.GetExchangeAccountDisclaimerId(itemId, AccountID);
|
||||
|
@ -777,5 +777,19 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#endregion
|
||||
|
||||
#region Picture
|
||||
[WebMethod]
|
||||
public ResultObject SetPicture(string accountName, byte[] picture)
|
||||
{
|
||||
return ExchangeServerController.SetPicture(accountName, picture);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public BytesResult GetPicture(string accountName)
|
||||
{
|
||||
return ExchangeServerController.GetPicture(accountName);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using WebsitePanel.Providers.Common;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
|
||||
namespace WebsitePanel.Providers.HostedSolution
|
||||
{
|
||||
|
@ -151,5 +152,9 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
ResultObject RemoveRetentionPolicyTag(string Identity);
|
||||
ResultObject SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks);
|
||||
ResultObject RemoveRetentionPolicy(string Identity);
|
||||
|
||||
// Picture
|
||||
ResultObject SetPicture(string accountName, byte[] picture);
|
||||
BytesResult GetPicture(string accountName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ using WebsitePanel.Providers.HostedSolution;
|
|||
using WebsitePanel.Providers.Utils;
|
||||
using WebsitePanel.Server.Utils;
|
||||
using WebsitePanel.Providers.Common;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
|
||||
using Microsoft.Exchange.Data.Directory.Recipient;
|
||||
using Microsoft.Win32;
|
||||
|
@ -7969,6 +7970,67 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
|
||||
#endregion
|
||||
|
||||
#region Picture
|
||||
public virtual ResultObject SetPicture(string accountName, byte[] picture)
|
||||
{
|
||||
ExchangeLog.LogStart("SetPicture");
|
||||
|
||||
ResultObject res = new ResultObject() { IsSuccess = true };
|
||||
|
||||
Runspace runSpace = null;
|
||||
try
|
||||
{
|
||||
runSpace = OpenRunspace();
|
||||
|
||||
Command cmd;
|
||||
|
||||
cmd = new Command("Import-RecipientDataProperty");
|
||||
cmd.Parameters.Add("Identity", accountName);
|
||||
cmd.Parameters.Add("Picture", true);
|
||||
cmd.Parameters.Add("FileData", picture);
|
||||
ExecuteShellCommand(runSpace, cmd, res);
|
||||
}
|
||||
finally
|
||||
{
|
||||
CloseRunspace(runSpace);
|
||||
}
|
||||
ExchangeLog.LogEnd("SetPicture");
|
||||
|
||||
return res;
|
||||
}
|
||||
public virtual BytesResult GetPicture(string accountName)
|
||||
{
|
||||
ExchangeLog.LogStart("GetPicture");
|
||||
|
||||
BytesResult res = new BytesResult() { IsSuccess = true };
|
||||
|
||||
Runspace runSpace = null;
|
||||
try
|
||||
{
|
||||
runSpace = OpenRunspace();
|
||||
|
||||
Command cmd;
|
||||
|
||||
cmd = new Command("Export-RecipientDataProperty");
|
||||
cmd.Parameters.Add("Identity", accountName);
|
||||
cmd.Parameters.Add("Picture", true);
|
||||
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, res);
|
||||
|
||||
if (result.Count > 0)
|
||||
{
|
||||
//res.Value = ;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
CloseRunspace(runSpace);
|
||||
}
|
||||
ExchangeLog.LogEnd("GetPicture");
|
||||
|
||||
return res;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ using WebsitePanel.Providers.Common;
|
|||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.Providers.Utils;
|
||||
using WebsitePanel.Server.Utils;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
using Microsoft.Exchange.Data.Directory.Recipient;
|
||||
using Microsoft.Win32;
|
||||
|
||||
|
@ -7146,5 +7147,17 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
|
||||
#endregion
|
||||
|
||||
#region Picture
|
||||
public virtual ResultObject SetPicture(string accountName, byte[] picture)
|
||||
{
|
||||
// not implemented
|
||||
return null;
|
||||
}
|
||||
public virtual BytesResult GetPicture(string accountName)
|
||||
{
|
||||
// not implemented
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ using System.Web.Services.Protocols;
|
|||
using System.Collections.Generic;
|
||||
using WebsitePanel.Providers;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
using WebsitePanel.Server.Utils;
|
||||
using Microsoft.Web.Services3;
|
||||
using WebsitePanel.Providers.Common;
|
||||
|
@ -1389,6 +1390,46 @@ namespace WebsitePanel.Server
|
|||
|
||||
#endregion
|
||||
|
||||
#region Picture
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public ResultObject SetPicture(string accountName, byte[] picture)
|
||||
{
|
||||
ResultObject res = null;
|
||||
try
|
||||
{
|
||||
LogStart("SetPicture");
|
||||
res = ES.SetPicture(accountName, picture);
|
||||
LogEnd("SetPicture");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogError("SetPicture", ex);
|
||||
throw;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public BytesResult GetPicture(string accountName)
|
||||
{
|
||||
BytesResult res = null;
|
||||
try
|
||||
{
|
||||
LogStart("GetPicture");
|
||||
res = ES.GetPicture(accountName);
|
||||
LogEnd("SetPicture");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogError("GetPicture", ex);
|
||||
throw;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
protected void LogStart(string func)
|
||||
{
|
||||
Log.WriteStart("'{0}' {1}", ProviderSettings.ProviderName, func);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue