Пример #1
0
        public ActionResult CreateDistributionGroup()
        {
            ViewBag.Formats  = DistributionGroup.Formats();
            ViewBag.Prefixes = DistributionGroup.Prefixes();
            ViewBag.Tooltip  = PowerShell.GetHTMLString("ITAdmin", "DistributionGroupGuidelines", null);

            return(View());
        }
        public static void GetFFOSDOItem(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            GetDistributionGroupCmdlet getDistributionGroupCmdlet = new GetDistributionGroupCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getDistributionGroupCmdlet.Authenticator  = PswsAuthenticator.Create();
            getDistributionGroupCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            DistributionGroup[] array = getDistributionGroupCmdlet.Run();
            if (array == null || array.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            DistributionGroup distributionGroup = array.First <DistributionGroup>();
            DataRow           dataRow           = table.Rows[0];

            dataRow["Identity"]             = new Identity(distributionGroup.Guid.ToString());
            dataRow["DisplayName"]          = distributionGroup.DisplayName;
            dataRow["PrimarySmtpAddress"]   = distributionGroup.PrimarySmtpAddress;
            dataRow["RecipientTypeDetails"] = DistributionGroupHelper.GenerateGroupTypeText(Enum.Parse(typeof(RecipientTypeDetails), distributionGroup.RecipientTypeDetails, true));
            dataRow["GroupType"]            = DistributionGroupHelper.GenerateGroupTypeText(Enum.Parse(typeof(RecipientTypeDetails), distributionGroup.RecipientTypeDetails, true));
            dataRow["Notes"] = distributionGroup.Notes;
            if (distributionGroup.ManagedBy == null || distributionGroup.ManagedBy.Length == 0)
            {
                dataRow["DisplayedManagedBy"] = null;
            }
            else
            {
                string[] value = (from o in distributionGroup.ManagedBy
                                  select o.Name).ToArray <string>();
                dataRow["DisplayedManagedBy"] = value;
            }
            GetGroupCmdlet getGroupCmdlet = new GetGroupCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getGroupCmdlet.Authenticator  = PswsAuthenticator.Create();
            getGroupCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            Group[] array2 = getGroupCmdlet.Run();
            if (array2 == null || array2.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            Group group = array2.First <Group>();

            if (group.Members == null || group.Members.Length == 0)
            {
                dataRow["MemberCount"] = 0;
            }
            else
            {
                dataRow["MemberCount"] = group.Members.Length;
            }
            dataRow["Notes"] = group.Notes;
        }
Пример #3
0
        private void WriteResult()
        {
            TaskLogger.LogEnter(new object[]
            {
                this.DataObject.Id
            });
            DistributionGroup sendToPipeline = new DistributionGroup(this.DataObject);

            base.WriteObject(sendToPipeline);
            TaskLogger.LogExit();
        }
        protected override void WriteResult(ADObject result)
        {
            TaskLogger.LogEnter(new object[]
            {
                this.DataObject.Identity
            });
            DistributionGroup result2 = new DistributionGroup((ADGroup)result);

            base.WriteResult(result2);
            TaskLogger.LogExit();
        }
Пример #5
0
        internal static string DistributionGroup(DistributionGroup distributionGroup, SNAPContext db)
        {
            try
            {
                ChangeLog changeLog = new ChangeLog();

                changeLog.Timestamp   = DateTime.Now;
                changeLog.Event       = "Distribution Group Created";
                changeLog.Description = String.Format("@{0} created", distributionGroup.Alias);
                changeLog.SubmittedBy = distributionGroup.Creator;

                db.ChangeLogs.Add(changeLog);
                db.SaveChanges();

                return(changeLog.Description);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Пример #6
0
        public ActionResult CreateDistributionGroup(DistributionGroup distributionGroup)
        {
            distributionGroup.Validate(ModelState, User);

            if (ModelState.IsValid)
            {
                if (distributionGroup.CreateDistributionGroup())
                {
                    string description = ChangeLog.DistributionGroup(distributionGroup, db);

                    ViewBag.Description = description;

                    return(View("Success"));
                }

                ModelState.AddModelError("Alias", "Failed to Create Distribution Group");
            }

            ViewBag.Formats  = DistributionGroup.Formats();
            ViewBag.Prefixes = DistributionGroup.Prefixes();
            ViewBag.Tooltip  = PowerShell.GetHTMLString("ITAdmin", "DistributionGroupGuidelines", null);

            return(View(distributionGroup));
        }
Пример #7
0
 // Token: 0x06000B5C RID: 2908 RVA: 0x000242C1 File Offset: 0x000224C1
 public RecipientOrOrganizationIdParameter(DistributionGroup group)
 {
     this.RecipientParameter = new GroupIdParameter(group);
 }
Пример #8
0
 public GroupIdParameter(DistributionGroup group) : base(group.Id)
 {
 }
 protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
 {
     return(DistributionGroup.FromDataObject((ADGroup)dataObject));
 }
 // Token: 0x06000CF5 RID: 3317 RVA: 0x000280B2 File Offset: 0x000262B2
 public DistributionGroupIdParameter(DistributionGroup dl) : base(dl.Id)
 {
 }
        public static void GetFFOItem(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            GetDistributionGroupCmdlet getDistributionGroupCmdlet = new GetDistributionGroupCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getDistributionGroupCmdlet.Authenticator  = PswsAuthenticator.Create();
            getDistributionGroupCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            DistributionGroup[] array = getDistributionGroupCmdlet.Run();
            if (array == null || array.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            DistributionGroup distributionGroup = array.First <DistributionGroup>();
            DataRow           dataRow           = table.Rows[0];

            dataRow["Identity"]           = new Identity(distributionGroup.Guid.ToString());
            dataRow["DisplayName"]        = distributionGroup.DisplayName;
            dataRow["Alias"]              = distributionGroup.Alias;
            dataRow["PrimarySmtpAddress"] = distributionGroup.PrimarySmtpAddress;
            dataRow["Notes"]              = distributionGroup.Notes;
            if (distributionGroup.ManagedBy == null || distributionGroup.ManagedBy.Length == 0)
            {
                dataRow["ManagedBy"] = null;
            }
            else
            {
                dataRow["ManagedBy"] = (from g in distributionGroup.ManagedBy
                                        select new JsonDictionary <object>(new Dictionary <string, object>
                {
                    {
                        "__type",
                        "JsonDictionaryOfanyType:#Microsoft.Exchange.Management.ControlPanel"
                    },
                    {
                        "Identity",
                        new Identity(g.Name, g.Name)
                    },
                    {
                        "DisplayName",
                        g.Name
                    },
                    {
                        "Name",
                        g.Name
                    }
                })).ToArray <JsonDictionary <object> >();
            }
            dataRow["EmailAddresses"] = distributionGroup.EmailAddresses;
            GetGroupCmdlet getGroupCmdlet = new GetGroupCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getGroupCmdlet.Authenticator  = PswsAuthenticator.Create();
            getGroupCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            Group[] array2 = getGroupCmdlet.Run();
            if (array2 == null || array2.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            Group group = array2.First <Group>();

            if (group.Members == null || group.Members.Length == 0)
            {
                dataRow["Members"] = null;
            }
            else
            {
                dataRow["Members"] = (from g in @group.Members
                                      select new JsonDictionary <object>(new Dictionary <string, object>
                {
                    {
                        "__type",
                        "JsonDictionaryOfanyType:#Microsoft.Exchange.Management.ControlPanel"
                    },
                    {
                        "Identity",
                        new Identity(g)
                    },
                    {
                        "DisplayName",
                        g
                    },
                    {
                        "Name",
                        g
                    }
                })).ToArray <JsonDictionary <object> >();
            }
            dataRow["Notes"] = group.Notes;
        }
Пример #12
0
 public DistributionGroupMemberIdParameter(DistributionGroup group) : base(group.Id)
 {
 }
Пример #13
0
 public MailboxFolderUserIdParameter(DistributionGroup recipient)
 {
     this.recipientIdParameter = new RecipientIdParameter(recipient.Id);
 }
Пример #14
0
        public static void ImportContacts(LyncClient _client)
        {
            ContactManager _contactManager = _client.ContactManager;
            XmlDocument    doc             = new XmlDocument();

            if (!File.Exists("BuddyList.xml"))
            {
                Console.WriteLine("BuddyList.xml does not exist.");
                Environment.Exit(0);
            }
            doc.Load("BuddyList.xml");
            XmlElement      root                     = doc.DocumentElement;
            XmlNodeList     groups                   = root.SelectNodes("ContactGroup");
            GroupCollection current_groups           = _contactManager.Groups;
            var             current_group_colelction = new List <string>();

            foreach (Group group in current_groups)
            {
                current_group_colelction.Add(group.Name);
            }

            foreach (XmlNode group in groups)
            {
                String group_name = group.ChildNodes.Item(0).FirstChild.Value;
                String group_type = group.Attributes.GetNamedItem("type").InnerText;
                if (group_type == "DistributionGroup")
                {
                    _contactManager.BeginSearch(
                        group_name,
                        (ar) =>
                    {
                        SearchResults searchResults = _contactManager.EndSearch(ar);
                        if (searchResults.Groups.Count > 0)
                        {
                            Console.WriteLine(searchResults.Groups.Count.ToString() + " found");
                            foreach (Group dg in searchResults.Groups)
                            {
                                Console.WriteLine(System.Environment.NewLine + dg.Name);
                                DistributionGroup dGroup = dg as DistributionGroup;
                                if (!current_groups.Contains(dGroup))
                                {
                                    if (group_name == dGroup.Name)
                                    {
                                        _contactManager.BeginAddGroup(dGroup, null, null);
                                    }
                                }
                            }
                        }
                        else
                        {
                            Console.WriteLine("No groups found for search on " + group_name);
                        }
                    },
                        null);
                }
                else if (group_type == "FavoriteContacts" || group_type == "FrequentContacts")
                {
                    //skip Favourites as it always exists
                    continue;
                }
                else
                {
                    //handle custom groups and favourites normally
                    //check first if group exists or error
                    if (!current_group_colelction.Contains(group_name))
                    {
                        //continue to adding new group
                        _contactManager.BeginAddGroup(group_name, null, null);
                        Console.WriteLine(group_name + " created.");
                    }
                    else
                    {
                        //show message and do not try to create group
                        Console.WriteLine(group_name + " already exists.");
                    }
                }
            }

            //add the contacts to each group of typer Custom or Favourites
            System.Threading.Thread.Sleep(2000);
            Console.WriteLine("Importing contacts...");
            foreach (XmlNode group in groups)
            {
                if (group.Attributes.GetNamedItem("type").InnerText != "DistributionGroup")
                {
                    foreach (Group igroup in current_groups)
                    {
                        if (igroup.Name == group.ChildNodes.Item(0).FirstChild.Value)
                        {
                            Console.WriteLine(igroup.Name + " - " + igroup.Type.ToString());
                            //add contacts
                            foreach (XmlNode contact in group.ChildNodes.Item(1).ChildNodes)
                            {
                                Console.WriteLine(contact.InnerText);
                                Contact c = _contactManager.GetContactByUri(contact.InnerText);
                                if (!igroup.Contains(c))
                                {
                                    igroup.BeginAddContact(c, null, null);
                                }
                            }
                        }
                    }
                }
            }
            Console.WriteLine("Finished import.");
        }