Access custom view column from exchange public folder - c#

I'm using Exchange Web Services to access contact records in a public folder. I need to pull a custom column, "Client Contact Management", created for a view in that folder. The custom column was created in the user interface.
I've already used the ExtendedPropertyDefinition class before on properties that I have created on my own through code. Is that what I'm supposed to use in this case and if so then how do I get the guid for the custom column?

I finally found the answer on this thread from David Sterling on the microsoft exchange server forums. His example (copied below) shows how to do things using EWS directly and using the managed api.
// via autogenerated proxy classes
PathToExtendedFieldType hairColorPath = new PathToExtendedFieldType();
hairColorPath.DistinguishedPropertySetId = DistinguishedPropertySetType.PublicStrings;
hairColorPath.DistinguishedPropertySetIdSpecified = true;
hairColorPath.PropertyName = "HairColor";
hairColorPath.PropertyType = MapiPropertyTypeType.String;
// via the Client API
ExtendedPropertyDefinition hairColor = new ExtendedPropertyDefinition(
DefaultExtendedPropertySet.PublicStrings,
"HairColor",
MapiPropertyType.String);
Here is what I did using the managed api for my own problem. The key is using the DefaultExtendedPropertySet.PublicStrings which is where outlook stores the custom view column.
ExtendedPropertyDefinition _clientContactManagementPropertyDefinition =
new ExtendedPropertyDefinition(
DefaultExtendedPropertySet.PublicStrings,
"Client Contact Management",
MapiPropertyType.Boolean
);

Related

Docusign Permissions: Shared Envelopes vs. Shared Access

I have been using the "Shared Envelopes" feature to allow specific users who are not the sender or a recipient of the envelope to be able to view an envelope in my application without any issues. I used the following instructions to do so:
How to embed the DocuSign UI in your app:
https://developers.docusign.com/docs/esign-rest-api/how-to/embed-ui/
This lays out using the SDK method Envelopes::createConsoleView.
However, DocuSign has deprecated "Shared Envelopes" in favor of their new "Shared Access".
I removed the users from the "Shared Envelopes" of the sending account and added them to "Shared Access" of the sending account. Unfortunately, when I make this change the users can no longer view the envelope and receive the following error message:
Error calling CreateConsoleView: {"errorCode":"USER_NOT_ENVELOPE_SENDER_OR_RECIPIENT","message":"This user is not the sender or a recipient of the envelope. Only the sender or a recipient of the envelope may perform the requested operation."}
Here is my code:
//API - EnvelopeViews:createConsoleView
public string GetEnvelopeViewUrl(string accountId, string envelopeId, string returnUrl)
{
var token = _tokenService.FetchToken(accountId);
var apiClient = new DocuSignClient($"{token.Account.BaseUri}/restapi");
apiClient.Configuration.DefaultHeader.Add("Authorization", $"Bearer {token.Value}");
var envelopesApi = new EnvelopesApi(apiClient);
var apiAccountId = _config["DocuSign:ApiAccountId"];
ConsoleViewRequest viewRequest = new ConsoleViewRequest
{
EnvelopeId = envelopeId,
ReturnUrl = returnUrl
};
var recipientView = envelopesApi.CreateConsoleView(apiAccountId, viewRequest);
return recipientView.Url;
}
I know the users in my app are not the sender or a recipient of the envelope. I thought that was the whole point of "Shared Access". Can anyone provide some guidance on how to enable the new "Shared Access" users to be able to view an envelope like they can with the old "Shared Envelopes" in my application?
Baxter, as of right now (November 2022) the new feature for Shared Access is only to support using the web app and does not provide any functionality for developers using the API.
The old feature, like you mentioned, called shared envelopes, was fully supporting the API and the call you made would work with that.
There's a future plan to support the API using Shared Access, but I don't know the details or the date. I can update this answer once I have this information.

Create Inbox rules by using the EWS Managed API

I am trying to create a rule by using EWS API for a shared mailbox. For that I am using the following code:
Rule newRule = new Rule();
newRule.DisplayName = "Forward";
forwardEmailTo= "xxx#hotmail.com";
newRule.Conditions.SentToAddresses.Add("Forward", "sharedmailbox#myexchangedomain.online");
newRule.Actions.ForwardToRecipients.Add(forwardEmailTo);
CreateRuleOperation createMoveIfFromSalesRule = new CreateRuleOperation(newRule);
service.UpdateInboxRules(new RuleOperation[] {createMoveIfFromSalesRule}, true);
But unfortunately the rule is not created on the shared mail box (sharedmailbox#myexchangedomain.online), it is being created on the principal mail box account.
What Am I doing wrong?
The UpdateInboxRules Method has an overload for the Mailbox you want to create the rule in so your method call should be
service.UpdateInboxRules(new RuleOperation[] {createMoveIfFromSalesRule,"TargetMailbxo#domain.com"}, true);

EWS API - Create calendar and share with reviewer permissions

I'm having some trouble on creating and share a calendar with review permissions using Exchange Webservice API .NET.
At the moment this is my code:
Folder addCalendar = new Folder(service);
addCalendar.DisplayName = name;
addCalendar.FolderClass = "IPF.Appointment";
var perm = new FolderPermission(new UserId("reviewer#test.com"),
FolderPermissionLevel.Reviewer);
addCalendar.Permissions.Add(perm);
addCalendar.Save(WellKnownFolderName.MsgFolderRoot);
The calendar is created, in my account I can see the calendar and the user 'reviewer#test.com' has the correct permissions.
The problem is: The calendar doesn't show at the reviewer's account.
You have to do two things:
Set the appropiate permissions:
var folder = Folder.Bind(service, WellKnownFolderName.Calendar);
folder.Permissions.Add(new FolderPermission("someone#yourcompany.com",
FolderPermissionLevel.Reviewer));
folder.Update();
Then, send an invitation message. Now, this is the hard part. The message format is specifified in [MS-OXSHARE]: Sharing Message Object Protocol Specification. The extended properties are defined in [MS-OXPROPS]: Exchange Server Protocols Master Property List. You need to create a message according to that specification and send it to the recipient.
EDITED:
To set the sharing properties on the element, use extended properties.
First, define the properties. For example, the PidLidSharingProviderGuidProperty is defined as follows:
private static readonly Guid PropertySetSharing = new Guid("{00062040-0000-0000-C000-000000000046}");
private static readonly ExtendedPropertyDefinition PidLidSharingProviderGuidProperty = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A01, MapiPropertyType.CLSID);
private static readonly ExtendedPropertyDefinition ConversationIdProperty = new ExtendedPropertyDefinition(0x3013, MapiPropertyType.Binary);
You can then set the property on a new item using the SetExtendedProperty method:
item.SetExtendedProperty(PidLidSharingProviderGuidProperty, "somevalue");
I figured out how to programmatically send a sharing invitation within an organization through EWS. May not answer all your questions, but it's a good start to understanding how in-depth you gotta get to actually do it. Heres the link

Creating New Message with default signature using Exchange Web Services

Currently a piece of our application creates and saves new mail messages to a user's drafts folder using Exchange Web Services. We would like to automatically append the user's default signature to these messages when creating them, but I have not been able to find a way to access the signature to append it to the body. The email message is currently created with the following code:
CreateItemType createEmailRequest = new CreateItemType();
createEmailRequest.MessageDisposition = MessageDispositionType.SaveOnly;
createEmailRequest.MessageDispositionSpecified = true;
DistinguishedFolderIdType draftsFolder = new DistinguishedFolderIdType();
draftsFolder.Id = distinguishedFolderIdNameType;
createEmailRequest.SavedItemFolderId = new TargetFolderIdType();
createEmailRequest.SavedItemFolderId.Item = draftsFolder;
MessageType emailMessage = new MessageType();
emailMessage.Subject = subject;
emailMessage.Body = new BodyType();
emailMessage.Body.BodyType1 = bodyType;
emailMessage.Body.Value = body;
emailMessage.Sensitivity = SensitivityChoicesType.Normal;
emailMessage.SensitivitySpecified = true;
createEmailRequest.Items = new NonEmptyArrayOfAllItemsType();
createEmailRequest.Items.Items = new ItemType[1];
createEmailRequest.Items.Items[0] = emailMessage;
Any ideas on how to get the current user's default signature and append it to the body the email?
The signatures in Outlook are a client-side feature and thus can't be accessed from Exchange Web Services. In fact I believe the signatures are actually stored in the users profile on the machine - I know I have to redo my signature when moving from one machine to another (I'm on Outlook/Exchange 2010).
In Exchange 2010 You can create a transport rule that can access user information, but there's not a way to use the Outlook signature information that I'm aware of.

How to delete recently created Google Contact?

I am temporary creating one contact and immediatly after that i want to delete that contact.
I am creating contact as follows:
ContactEntry[] ContactEntry = new ContactEntry[2];
ContactEntry[0] = new ContactEntry();
ContactEntry[0].Title.Text = "Temp";
Uri feedUri = new Uri(ContactsQuery.CreateContactsUri("default"));
ContactEntry createdEntry = (ContactEntry)obj_ContactService.Insert(feedUri, ContactEntry[0]);
In order to delete above contact if i use:
ContactEntry[0].Delete();
It is throwing Exception : "No Service object set".
Note: I am using Google Apps API Ver 2 for .NET
Rather than deleting the original data holder object you should delete the instance you got from the google server. Like this:
createdEntry.Delete();
This could help you out...
http://code.google.com/apis/contacts/docs/2.0/developers_guide_dotnet.html#Deleting
Edit: As the API says, you need a ContactRequest instance to call the Delete method. I dont see that in the snippet you posted

Categories

Resources