How do you add multiple user folder permissions to a single folder in EWS? Without them being reset? So if i wanted to give usera#domain.com and userb#domain.com permissions to one folder at once?
UserId user = new UserId();
user.PrimarySmtpAddress ="userabc#domain.com";
FolderPermission fldperm = new FolderPermission(user, FolderPermissionLevel.Editor);
strfolder.Permissions.Add(fldperm);
strfolder.Update();
Can you not use the FolderPermissionCollection. Add all permissions to that collection then use the AddRange property to add the FolderPermissionCollection.
Thanks
Niall
Related
Currently, I am creating a user with
var user = new UserPrincipal(localMachineContext, "MyUser1", "MyPassword", enabled: true);
user.Save();
However, new user is immediately included into "HomeUsers" group (Win10), which is undesired behavior. I can then go through all the groups in local machine, and remove this new user from them, but wonder if there's a better way to create the user, so it does not belong to any group initially?
All new users automatically get added to the Users group. To make a user with no groups you would need to remove the user from the group after creation.
Hi I'm trying to update my distribution lists menagers using LDAP
And I need to know what is the attribute of the "manager can update membership list" checkbox
I want only use c# NOT vbs or powershell
I can update the menageby but I prefer that you write it for the exmple..
The simple answer is there is no attribute for the "Manager can update membership list" checkbox, the check box is a security setting. When you check it the security of the group is modified to include the manager with the required permissions, unticking removes the managers rights under the security tab to modify the group.
You can use the ObjectSecurity to see if a SID has a unique ACL entry, in a standard environment this should be enough. This code should give you an idea of how to do it.
NTAccount acc = new NTAccount(managersam);
SecurityIdentifier sid = (SecurityIdentifier)acc.Translate(typeof(SecurityIdentifier));
ActiveDirectorySecurity sdc = YourGroupObject.ObjectSecurity;
AuthorizationRuleCollection arc= sdc.GetAccessRules(true, false, Type.GetType("System.Security.Principal.SecurityIdentifier"));
foreach (AuthorizationRule ar in arc) {
if (ar.IdentityReference== sid
{
managercanedit= true;
}
}
Getting default inbox works like the following:
_outlookNameSpace = this.Application.GetNamespace("MAPI");
_inbox = _outlookNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
Now on the same lines, how do get the inbox for the other exchange account say "abc#corp.com" ?
Thanks in advance.
Assuming the second mailbox is already in the profile, you need to find the appropriate account in the Namespace.Stores collection and call Store.GetDefaultFolder.
Otherwise you can call Namespace.GetSharedDefaultFolder.
I have a similar situation, where the 2nd account is identified by its .DisplayName property, which can be set in Account Setup. To find the Account, use:
var account = Globals.Addin.Application.GetNamespace("MAPI")
.Accounts.Cast<Account>()
.FirstOrDefault(a => a.DisplayName == "TargetDisplayName");
Then use Account.DeliveryStore to get access to the store and find the folder. .GetDefaultFolder gives you the folder:
DraftsFolder = (Folder) account.DeliveryStore.GetDefaultFolder(OlDefaultFolders.olFolderDrafts);
what is the best simple way to show who is online in c# without using membership control?
Is the only way is using session ?
You can do this via:
var onlineUsers = System.Web.Security.Membership.GetAllUsers()
.Cast<System.Web.Security.MembershipUser>()
.Where(user => user.IsOnline);
But you will need to cache/refresh this properly, since it can be a very expensive operation.
yes go to global.asax and create a new List<> of your User Class type in application_start event and save it to Cache
List<User> OnlineUsers = new List<User>();
Cache.Insert ("onlineuser",OnlineUsers,...);
and in your loginButton code get the list from cache and add the logged in user
User loggedin =someHelperCode.GetUser (txtUserName.Text,txtPassword.Text);
((List<User>)Cache["onlineuser"]).Add (loggedin);
and when a user logs out do the same and remove the user
and you can just bind the list to any lost bound control
I'm using Microsoft.Exchange.WebServices to work with some public folders and their items.
I would like to create a View item link to a specific item (Microsoft.Exchange.WebServices.Data.Item), but I can't figure out how to get it's path.
something like:
var theLink =
string.Format(#"Click here", item.XXXX);
Any suggestions?
It seems to not be possible anymore to due security.
Instead I created a link to Outlook Web Access instead.