31.10.2014 Views

Developer's Guide - EPiServer World

Developer's Guide - EPiServer World

Developer's Guide - EPiServer World

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Tutorials | 117<br />

Import Necessary Namespaces<br />

First, import the necessary namespaces that will be needed for this, the namespaces StarCommunity.Core,<br />

StarCommunity.Core.Modules.Security and StarCommunity.Modules.VideoGallery<br />

The StarCommunity.Modules.VideoGallery namespace contains classes for creating video galleries and uploading videos<br />

for transcoding into a web friendly format, like Adobe Flash Video.<br />

StarCommunity.Modules.Webmail are described by clicking on their respective names. Make sure you also add the<br />

mentioned assemblies as references, as mentioned in section 1.1.1.<br />

using StarCommunity.Core;<br />

using StarCommunity.Core.Modules.Security;<br />

using StarCommunity.Modules.Webmail;<br />

Soft Removing an Account<br />

To disable an account, we get the account for the relevant user and call the SoftRemoveMailAccount method in the<br />

handler. Note that this is automatically done when soft removing a user in the administration interface.<br />

IUser user = (IUser)StarCommunitySystem.<br />

CurrentContext.DefaultSecurity.GetUser(17);<br />

MailAccount account = WebmailHandler.GetMailAccount(user);<br />

WebmailHandler.SoftRemoveMailAccount(account);<br />

Now the account has been disabled. This means that no mail can be delivered to it and that you can no longer get mail<br />

from this account.<br />

Restoring a soft removed account<br />

To reactivate a disabled account, we get the account for the relevant user and call the SoftRestoreMailAccount method<br />

in the handler. Note that this is automatically done when restoring a user in the administration interface.<br />

IUser user = (IUser)StarCommunitySystem.<br />

CurrentContext.DefaultSecurity.GetUser(17);<br />

MailAccount account = WebmailHandler.GetMailAccount(user);<br />

WebmailHandler.SoftRestoreMailAccount(account);<br />

Now the account has been restored. Any messages which were there before the account was disabled are now<br />

available again.<br />

© <strong>EPiServer</strong> AB

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!