...
Code Block |
---|
|
//Return a list of locked out accounts
var account = C.Account.GetByLockedOut(true);
//Unlock each account in the list
foreach(var acc in account)
acc.Unlock(); |
Working with random objects
Create mailbox for user
Code Block |
---|
|
//Add reference for TheDotNetFactory.Framework.People.Common.Enum to your project for access to the ExchangeMailboxTypeList enum
//Return an account without a mailbox
var accountCollection = C.AccountView.GetNonMailboxAccountsByAccountStoreID("LogonName", "jclouseay");
//Get the account store
var accStore = C.AccountStore.GetByFQN("exchange.com");
//Configure the mailbox you are creating
foreach (var acc in accountCollection)
{
var mailboxConfig = new C.MailBoxConfig();
mailboxConfig.AccountStore = accStore;
mailboxConfig.Alias = acc.LogonName;
mailboxConfig.cn = acc.Name;
mailboxConfig.MasterAccountID = acc.DistinguishedName;
//Set the MailboxContainer
var mailboxContainer = C.ExchangeMailboxObjectContainer.GetByMostAvailableSpace();
foreach (var mBC in mailboxContainer)
mailboxConfig.MailboxContainer = mBC;
mailboxConfig.AccountStore = accStore;
mailboxConfig.Path = acc.DistinguishedName;
//Person linked with the account
var owner = C.Person.GetByLogin(acc.LogonName);
//Set the account
var targetAccount = C.Account.GetByAccountID(acc.AccountID);
//Create the mailbox, passing in owner, targetAccount, and mailboxConfig
//Also set the type of mailbox and process it immediately
var createMailbox = C.ExchangeMailbox.CreateMailbox(owner, targetAccount, mailboxConfig, ExchangeMailboxTypeList.UserMailbox, refreshRbac: true, sendToQueue: false);
//Write the results to the console
Console.WriteLine("Mailbox with MailboxID: {0} has been created for Account: {1}", createMailbox.ExchangeMailboxID, CreateteMailbox.AccountIDSource.FriendlyName);
} |
Create an Audit Log entry
Code Block |
---|
|
AuditLogOperation log = new AuditLogOperation();
log.Name = "Updated Account Store Settings for " + this.TargetAccountStore.Name + " in workflow: " + this.CurrentWorkflow.Name;
log.Description = log.Name;
log.ActorPersonID = this.CurrentWorkflow.Initiator.PersonID;
log.FriendlyName = log.Name;
log.TargetResourceID = 0;
log.AuditLogOperationTypeID = 1;
log.Insert(); |
Tracing
Code Block |
---|
|
TdnfTrace.Current.TraceData(TraceEventType.Verbose, 411, "!!!!!######Person has " + this.CurrentWorkflow.PersonNumberofAzureAccounts.ToSafeNullableString() + " Azure AD Accounts"); |
How to use the rawmarkup control and then set the value in a WF to a localized message
Rawmarkup form control - read-only - doublewide
Code Block |
---|
|
<div data-bind="html: Value()"></div> |
Set value on activity in code
Code Block |
---|
|
CurrentWorkflow.editEligibilityForm.Disclaimer = "EditITShopSettingsMultipleGroupsDisclaimer".Localize(); |
Retrieve a Global EmpowerID System Config Setting
Code Block |
---|
|
int.TryParse((ConfigSettings.Get(RegistryType.WebSettings, "ABACHighRiskScore")), out highRiskScore); |
How to fire one of the older style alerts
Code Block |
---|
|
//Fire event on success
var alert = new Alert
{
AlertEventTypeID = (int)Entities.BPMAlertEventTypeList.PersonCommunicationTypeAdded,
Name = "Person Communication Type Added",
Priority = ThreadPriority.Highest
};
alert.Properties["Person"] = user;
WebAlertManager.Current.EnqueueAlert(alert);
Update(); |
Get list of operations person has for a resource
Code Block |
---|
|
return C.Person.GetPersonResourceOperationsDictionaryCached(PersonID, ResourceID).ContainsKey(Operation); |
Check and return true if person has a specific operation for a resource
Code Block |
---|
|
return C.Person.GetPersonResourceOperationsDictionaryCached(PersonID, ResourceID).ContainsKey(Operation); |
Check if person can do operation for resource
Code Block |
---|
|
C.Resource.HasAccess(YourObject.PersonID,YourResource.ResourceID,"NameofOperationToCheck"); |
Check if approver decision was approved (old collaboration task engine - not business requests)
Code Block |
---|
|
this.CurrentWorkflow.LoginAssistSSApproverForm.FormDecision == E.BusinessProcessTaskSlotResponseTypeList.Approved; |
Check if a Person can run the Workflow (WF)
Code Block |
---|
|
rw = C.RequestWorkflow.GetByRequestWorkflowIDWithCache(this.CurrentWorkflow.RequestWorkflowID);
if (rw.ResourceID != null)
{
this.CurrentWorkflow.HasAccessToRunWorkflow = (C.Resource.HasUseAccessToResource(this.CurrentWorkflow.TargetPerson.PersonID,rw.ResourceID) != null);
}
if(this.CurrentWorkflow.HasAccessToRunWorkflow)
{
TdnfTrace.Current.TraceData(TraceEventType.Verbose, 411, "!!!!!######Person has access to run the workflow");
}
else
{
TdnfTrace.Current.TraceData(TraceEventType.Verbose, 411, "!!!!!######Person does not have access to run the workflow");
} |
Taking a list of heavy person objects and creating a light list of person objects with IDs
Code Block |
---|
|
var peopleIds = CurrentWorkflow.PeopleAsMembers.SelectedValues.Select(p => p.PersonID).ToList();
//This makes the get accounts call lightweight
var people = new E.TList<C.Person>();
foreach(var id in peopleIds)
{
people.Add(new C.Person{PersonID = id});
} |