Using content management API
Hi all,
i'm a beginer in weblogic portal.
i want to use content management API to publish content, such as add content type, add content, edit content . . .
can anybody help me or give me document link.
Thanks!!!
There used to be a contentSamples App that pretty much did most of this, I cant find this online.
i have the zip for 9.2 (there shouldnt be many changes between 9.2 and 10) , if you want a copy of this app send me your email
Similar Messages
-
How to get list of Users[MailBoxes] in Exchange Server 2013 by using EWS Managed API
Hi all,
I need list of Users exists in my Exchange server 2013 , i.e Mail Box Users login name.
I was created Full Access permissions of all users to Admin user account, to access each user Mailbox programatically
i need the list of Mailboxes in exchange server .
MailBox mailbox = new MailBox("user");
Please share your ideasHi,
We can run the following command in Exchange Management Shell to get all user mailboxes name and export it to a .csv file:
Get-Mailbox -ResultSize Unlimited | Select Name,Alias,RecipientTypeDetails | Export-Csv c:\Users.csv
If you want to retrieve the list of users by using EWS Managed API, I suggest you can ask a question in Exchange Development forum for more suggestion:
http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads
Regards,
Winnie Liang
TechNet Community Support -
Create and send an email as a delegate using EWS Managed API
Hi All,
I would like to create and send an email as a delegate using EWS Managed API for that i have crated one user as a delegate to that mailbox owner.
after adding user as delegate, when i try to create an email The EmailMessage class taking only FolderId as parameter but not taking Mailbox object as parameter. But in web reference they said that EmailMessage taking FolderId and Mailbox object as parameter.
EmailMessage message = new EmailMessage(service);
message.Subject = "Company Soccer Team";
message.Body = "Are you interested in joining?";
message.ToRecipients.Add("[email protected]");
message.Save(new FolderId(WellKnownFolderName.Drafts, new Mailbox("[email protected]")));https://msdn.microsoft.com/EN-US/library/office/dn641963(v=exchg.150).aspx#bk_createewsmacould you people please help me on this?ThanksNareshThanks for reply glen.
I have added delegate using Add-MailboxPermissions. Now i am able to save an email in mailbox owner drafts
folder.
Glen,
I have a one more question.(I am using EWS Managed API).
I(owner) have shared my calendar(eg. samplecalenderfolder) with another user(delegate) (i.e.,he is the
delegate of my mailbox) and i have given only permission to the this folder(samplecalenderfolder)
only and the permission level is Reviewer.
if i login with user(i.e.delegate) i am not able to get the shared calendar folders(i.e.,samplecalenderfolder)
that what i a have shared.
below is the code snippet i am using to get the calendar folders.
Folder folder = Folder.Bind(service,WellKnownFolderName.Calendar);
FindFoldersResults addtionalFolders = service.FindFolders(folder.Id, new FolderView(10));
could you please tell us how to get the shared calendar folders.
Thanks
Naresh -
Configure hosted services verbose monitoring using REST management API
I know how to configure verbose monitoring for my hosted services in the management portal as described in: http://www.windowsazure.com/en-us/manage/services/cloud-services/how-to-monitor-a-cloud-service/
Is it possible to do the same using the management API? What is the REST command?
Thanks
Manu
ManuI don't think there's a public REST API available just yet for cloud services monitoring. Given that Windows Azure Portal is built on top of Service Management API, I'm pretty sure that there's an API beneath this monitoring but is not exposed just yet for
general consumption. I would recommend keeping an eye on Service Management API documentation page for updates:
http://msdn.microsoft.com/en-us/library/windowsazure/ee460799.aspx
Hope this helps. -
Use oes management api get "No privilege" error
Hi all,
i try to use oes management api to manage my application's entitlements.
but while i coding get a “No privilege” error , any suggest ?
regards
java code:
RBAC_Manager mgr = null;
RBAC_Context rbacCtx = null;
mgr = new RBAC_Manager(new URL("https://10.1.18.4:7011/servlet/AxisServlet/blm"),"admin","password");
rbacCtx = mgr.createContext();
System.out.println("user -> " + rbacCtx.getLoginUser());
ScopeManager scopeMgr = rbacCtx.getScopeManager();
Organization o = scopeMgr.getRoot();
rbacCtx.setScope(o);
Scope s = rbacCtx.getScope();
s = scopeMgr.getScope("ejianlong");
rbacCtx.setScope(s);
scopeMgr = rbacCtx.getScopeManager();
scopeMgr.createApplication("jlerp_a");output:
user -> //user/RootOrg!AdminDir/admin/
com.bea.ales.management.exception.ManagementException: No privilege to create Application jlerp_a under RootOrg!ejianlong
at com.bea.ales.management.ScopeManager.createApplication(ScopeManager.java:156)
at com.jl.test.model.Class1.main(Class1.java:36)Edited by: Lighting Cui on 2011-9-12 下午5:34Have worked it out...
In case anyone else has the same thing happening, the issue was with the external hard drive. I had read-only privileges while it was connected to my new MacBook. It's a Seagate GoFlex. Had to download the NTFS for Mac driver from their website
http://www.seagate.com/au/en/support/external-hard-drives/desktop-hard-drives/ba ckup-plus-desk/ntfs-driver-for-mac-os-master-dl/
and installed it on the laptop. Then I selected the GoFlex volume, Command I and changed the access to read and write. Problem solved. -
Programmatic "Content management API"?
Is there any programmatic (Java) "Content management API"?
I'm developing a webservice through which I want to "simulate" user activity in the portal - to add items, create folders etc.
My concept:
Deploy a Java webservice that calls CM API.
Call this webservice from a different (nonJava) application to do the task.
In other words, I need an API to connect to. Is it a good concept or possible at all?
Or is the only way PL\SQL?
Is this the right forum to ask?
Thank you, PeterEmil,
even there are not yet Java APIs for Content management, you can rely on PL/SQL APIs that exist.
These APIs are provided trough a database plsql package which is : WWSBR_API.(since 9.0.2.6)
http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1012/wwsbr_api.html
You just need, either to generate a WebService based on the different procedures of functions, or create you own WebServices accessing to these pacakges via jdbc.
Jdeveloper provide a wizzard for generating a WS from an existing PLSQL package.
There are some limitations (restrictions on data types or collections), but that works for most of case.
About Content API, there is a good probability that these APIs become more rich (I don't know if it will be both for Java and PlSql).
Patrick. -
Trying to retrieve list of rooms using EWS Managed API but it returned empty collection
Hi,
I'm trying to retrieve list of rooms using EWS Managed API. Before I have tried the following code I make sure our Administrator put all the rooms in a list following link https://technet.microsoft.com/en-us/library/ee633471%28v=exchg.141%29.aspx.
Here is the simple code I have used :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Exchange.WebServices.Data;
using System.Net;
using System.Security;
namespace ExchangeConsole1
class Program
static void Main(string[] args)
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.Credentials = new NetworkCredential("username", "Password1", "domain");
service.Url = new Uri("https://email.xxxx.com/ews/exchange.asmx");
EmailMessage email = new EmailMessage(service);
EmailAddressCollection listOfRoomList = service.GetRoomLists();
// Display the individual rooms.
foreach (EmailAddress address in listOfRoomList)
Console.WriteLine("Email Address: {0}", address.Address);
service.GetRoomLists() results "Enumeration yielded no results". Could anybody help me please ?
Thanks
SandipanEnable tracing and see what the response from the server looks like. Also depending on your setup and how long ago your administrator created the list, it may take some
time to replicate.
Administrator has done it one week ago. Here is the trace response I am getting
<Trace Tag="EwsResponse" Tid="9" Time="2015-04-10 15:36:37Z" Version="15.00.0847.030">
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="0" MajorBuildNumber="995" MinorBuildNumber="31" Version="V2_15" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<m:GetRoomListsResponse ResponseClass="Success" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseCode>NoError</m:ResponseCode>
<m:RoomLists />
</m:GetRoomListsResponse>
</s:Body>
</s:Envelope>
</Trace>
It's say no error. Any help ?
Thanks
Sandipan -
public void ShareCalendar(Calendar calendar)
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
service.Credentials = new NetworkCredential("user1", "password", "domain");
service.Url = new Uri("https://sampleUrl/ews/exchange.asmx");
try
// Bind to the folder
//Folder folderStoreInfo;
//folderStoreInfo = Folder.Bind(service, calendar.ExchangeId);
//string EwsID = folderStoreInfo.Id.UniqueId;
string EwsID = calendar.FolderExchangeId;
// The value of folderidHex will be what we need to use for the FolderId in the xml file
AutodiscoverService autoDiscover = new AutodiscoverService(ExchangeVersion.Exchange2013);
autoDiscover.Credentials = new NetworkCredential("user1", "password", "domain");
autoDiscover.RedirectionUrlValidationCallback = RedirectionUrlValidationCallback;
Dictionary<string, string> userSettings = GetUserSettings(autoDiscover);
string folderidHex = GetConvertedEWSIDinHex(service, EwsID, "[email protected]");
string domainName = string.Empty;
string mailBoxServer = string.Empty;
string userName = string.Empty;
foreach (var item in userSettings)
switch (item.Key)
case "UserDN":
domainName = item.Value.ToString();
break;
case "InternalMailboxServer":
mailBoxServer = item.Value.ToString();
break;
case "UserDisplayName":
userName = item.Value.ToString();
break;
string entryId = GetIntiatorEntryID(domainName);
string mailboxId = GetInvitationMailboxId(mailBoxServer, domainName);
string sharedFilePath = CreateSharingMessageAttachment(folderidHex, userName, entryId, mailboxId, "[email protected]", "calendar", calendar.FolderName);
// Create a new message
EmailMessage invitationRequest = new EmailMessage(service);
invitationRequest.Subject = "I'd like to share my calendar with you";
invitationRequest.Body = "Sent by Exchange Administrator on behalf of user";
//invitationRequest.Culture = "en-US";
invitationRequest.Sensitivity = Sensitivity.Normal;
// Set a sharing specific property on the message
invitationRequest.ItemClass = "IPM.Sharing"; /* Constant Required Value [MS-ProtocolSpec] */
byte[] byteEntryId = HexStringToByteArray(entryId);
// This is the Guid of the Sharing Provider in Exchange, and it's value does not change
Guid binSharingProviderGuid = new Guid("{AEF00600-0000-0000-C000-000000000046}");
// Even though I don't think setting this property is mandatory,
// it just seemed like the right thing to do and it works so I \
// ain't messin with it!
byte[] byteSharingProviderGuid = binSharingProviderGuid.ToByteArray();
string strPRBODYHTML = "<html dir=\"ltr\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n<meta name=\"GENERATOR\"
content=\"MSHTML 8.00.7601.17514\">\r\n<style id=\"owaParaStyle\">P {\r\n MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px \r\n}\r\n</style>\r\n</head>\r\n<body fPStyle=\"1\" ocsi=\"0\">\r\n<tt>\r\n<pre>SharedByUserDisplayName
(SharedByUserSmtpAddress) has invited you to view his or her Microsoft Exchange Calendar.\r\n\r\nFor instructions on how to view shared folders on Exchange, see the following article:\r\n\r\nhttp://go.microsoft.com/fwlink/?LinkId=57561\r\n\r\n*~*~*~*~*~*~*~*~*~*\r\n\r\n</pre>\r\n</tt>\r\n<div>\r\n<div
style=\"direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;\">this is a test message</div>\r\n</div>\r\n</body>\r\n</html>\r\n";
string strBODY = @"
SharedByUserDisplayName (SharedByUserSmtpAddress) has invited you to view his or
her Microsoft Exchange Calendar.
For instructions on how to view shared folders on Exchange, see the
following article:
http://go.microsoft.com/fwlink/?LinkId=57561
*~*~*~*~*~*~*~*~*~*
test body
// Convert these to hex and binary equivelants to assign to their relevant
// extended properties
string hexPRBODYHTML = ConvertStringToHex(strPRBODYHTML);
byte[] binPRBODYHTML = HexStringToByteArray(hexPRBODYHTML);
Guid PropertySetSharing = Guid.Parse("00062040-0000-0000-C000-000000000046");//constant
Guid PropertySetInternetHeaders = Guid.Parse("00020386-0000-0000-C000-000000000046");//constant
ExtendedPropertyDefinition PidLidSharingProviderGuidProperty = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A01, MapiPropertyType.CLSID);
ExtendedPropertyDefinition ConversationIdProperty = new ExtendedPropertyDefinition(0x3013, MapiPropertyType.Binary);
// Sharing Properties (in order of reference according to protocol examples in: [MS-OXSHARE])
// Additional Property Constraints
// [MS-OXSHARE] 2.2.5.2
ExtendedPropertyDefinition PidTagMessageClass = new ExtendedPropertyDefinition(0x001A, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.5.1
//ExtendedPropertyDefinition PidNameContentClass = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "Content-Class", MapiPropertyType.String);
ExtendedPropertyDefinition PidNameContentClass = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "Content-class", MapiPropertyType.String);
// Common Message Object Properties
// [MS-OXSHARE] 2.2.1
ExtendedPropertyDefinition PidTagNormalizedSubject = new ExtendedPropertyDefinition(0x0E1D, MapiPropertyType.String);
// The PidTagSubjectPrefix is a zero-length string, so I do not set it
// ExtendedPropertyDefinition PidTagSubjectPrefix = new ExtendedPropertyDefinition(0x003D, MapiPropertyType.String);
// Sharing Object Message Properties
// [MS-OXSHARE] 2.2.2.12
ExtendedPropertyDefinition PidLidSharingProviderGuid = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A01, MapiPropertyType.Binary);
// [MS-OXSHARE] 2.2.2.13
ExtendedPropertyDefinition PidNameXSharingProviderGuid = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Provider-GUID", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.14
ExtendedPropertyDefinition PidLidSharingProviderName = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A02, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.15
ExtendedPropertyDefinition PidNameXSharingProviderName = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Provider-Name", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.16
ExtendedPropertyDefinition PidLidSharingProviderUrl = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A03, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.17
ExtendedPropertyDefinition PidNameXSharingProviderUrl = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Provider-URL", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.5
ExtendedPropertyDefinition PidLidSharingFlavor = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A18, MapiPropertyType.Integer);
// [MS-OXSHARE] 2.2.2.6
ExtendedPropertyDefinition PidNameXSharingFlavor = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Flavor", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.1
ExtendedPropertyDefinition PidLidSharingCapabilities = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A17, MapiPropertyType.Integer);
// [MS-OXSHARE] 2.2.2.2
ExtendedPropertyDefinition PidNameXSharingCapabilities = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Capabilities", MapiPropertyType.String);
// Sections 2.3 and 2.4 are also zero-length strings, so I won't set those either
// [MS-OXSHARE] 2.2.2.3
// ExtendedPropertyDefinition PidLidSharingConfigurationUrl = new //ExtendedPropertyDefinition(PropertySetSharing, 0x8A24, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.4
//ExtendedPropertyDefinition PidNameXSharingConfigUrl = new //ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "X-Sharing-Config-Url", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.10
ExtendedPropertyDefinition PidLidSharingLocalType = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A14, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.11
ExtendedPropertyDefinition PidNameXSharingLocalType = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Local-Type", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.7
ExtendedPropertyDefinition PidLidSharingInitiatorEntryId = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A09, MapiPropertyType.Binary);
// [MS-OXSHARE] 2.2.2.8
ExtendedPropertyDefinition PidLidSharingInitiatorName = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A07, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.9
ExtendedPropertyDefinition PidLidSharingInitiatorSMTP = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A08, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.1
ExtendedPropertyDefinition PidLidSharingRemoteName = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A05, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.2
ExtendedPropertyDefinition PidNameXSharingRemoteName = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Name", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.5
ExtendedPropertyDefinition PidLidSharingRemoteType = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A1D, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.6
ExtendedPropertyDefinition PidNameXSharingRemoteType = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Type", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.7
ExtendedPropertyDefinition PidLidSharingRemoteUid = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A06, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.8
ExtendedPropertyDefinition PidNameXSharingRemoteUid = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Uid", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.3
ExtendedPropertyDefinition PidLidSharingRemoteStoreUid = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A48, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.4
ExtendedPropertyDefinition PidNameXSharingRemoteStoreUid = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Store-Uid", MapiPropertyType.String);
//From troubleshooting I noticed I was missing
ExtendedPropertyDefinition PidTagPriority = new ExtendedPropertyDefinition(0x0026, MapiPropertyType.Integer);
ExtendedPropertyDefinition PidTagSensitivity = new ExtendedPropertyDefinition(0x0036, MapiPropertyType.Integer);
ExtendedPropertyDefinition PR_BODY_HTML = new ExtendedPropertyDefinition(0x1013, MapiPropertyType.Binary); //PR_BOD
ExtendedPropertyDefinition PR_BODY = new ExtendedPropertyDefinition(0x1000, MapiPropertyType.String);
ExtendedPropertyDefinition RecipientReassignmentProhibited = new ExtendedPropertyDefinition(0x002b, MapiPropertyType.Boolean);
// Section 2.2.1
invitationRequest.SetExtendedProperty(PidTagNormalizedSubject, "I'd like to share my calendar with you"); /* Constant Required Value [MS-OXSHARE] 2.2.1 */
//invitationRequest.SetExtendedProperty(PidTagSubjectPrefix, String.Empty); /* Constant Required Value [MS-OXSHARE] 2.2.1 */
// Section 2.2.2
invitationRequest.SetExtendedProperty(PidLidSharingCapabilities, 0x40220); /* value for Special Folders */
invitationRequest.SetExtendedProperty(PidNameXSharingCapabilities, "40220"); /* Test representation of SharingCapabilities value */
//invitationRequest.SetExtendedProperty(PidLidSharingConfigurationUrl, String.Empty); /* Zero-Length String [MS-OXSHARE] 2.2.2.3 */
//invitationRequest.SetExtendedProperty(PidNameXSharingConfigUrl, String.Empty); /* Zero-Length String [MS-OXSHARE] 2.2.2.4 */
invitationRequest.SetExtendedProperty(PidLidSharingFlavor, 0x20310); /* Indicates Invitation for a special folder [MS-OXSHARE] 2.2.2.5 */
invitationRequest.SetExtendedProperty(PidNameXSharingFlavor, "20310"); /* Text representation of SharingFlavor value [MS-OXSHARE] 2.2.2.6 */
invitationRequest.SetExtendedProperty(PidLidSharingInitiatorEntryId, byteEntryId); /* Value from the Initiator/EntryId value in the Sharing Message attachment .xml document */
invitationRequest.SetExtendedProperty(PidLidSharingInitiatorSMTP, "[email protected]"); /* Value from Initiator/Smtp Address in the Sharing message attachment .xml document */
invitationRequest.SetExtendedProperty(PidLidSharingInitiatorName, "User1"); /* Value from Initiator/Name Address in the Sharing message attachment .xml document */
invitationRequest.SetExtendedProperty(PidLidSharingLocalType, "IPF.Appointment"); /* MUST be set to PidTagContainerClass of folder to be shared */
invitationRequest.SetExtendedProperty(PidNameXSharingLocalType, "IPF.Appointment"); /* MUST be set to same value as PidLidSharingLocalType */
invitationRequest.SetExtendedProperty(PidLidSharingProviderGuid, byteSharingProviderGuid); /* Constant Required Value [MS-OXSHARE] 2.2.2.12 */
invitationRequest.SetExtendedProperty(PidNameXSharingProviderGuid, "AEF0060000000000C000000000000046"); /* Constant Required Value [MS-OXSHARE] 2.2.2.13 */
invitationRequest.SetExtendedProperty(PidLidSharingProviderName, "Microsoft Exchange"); /* Constant Required Value [MS-OXSHARE] 2.2.2.14 */
invitationRequest.SetExtendedProperty(PidNameXSharingProviderName, "Microsoft Exchange"); /* Constant Required Value [MS-OXSHARE] 2.2.2.15] */
invitationRequest.SetExtendedProperty(PidLidSharingProviderUrl, "http://www.microsoft.com/exchange"); /* Constant Required Value [MS-OXSHARE] 2.2.2.16 */
invitationRequest.SetExtendedProperty(PidNameXSharingProviderUrl, "http://www.microsoft.com/exchange"); /* Constant Required Value [MS-OXSHARE] 2.2.2.17 */
// Section 2.2.3
invitationRequest.SetExtendedProperty(PidLidSharingRemoteName, calendar.FolderName); /* MUST be set to PidTagDisplayName of the folder being shared */
invitationRequest.SetExtendedProperty(PidNameXSharingRemoteName, calendar.FolderName); /* MUST be set to same value as PidLidSharingRemoteName */
invitationRequest.SetExtendedProperty(PidLidSharingRemoteStoreUid, mailboxId); /* Must be set to PidTagStoreEntryId of the folder being shared */
invitationRequest.SetExtendedProperty(PidNameXSharingRemoteStoreUid, mailboxId); /* MUST be set to same value as PidLidSharingRemoteStoreUid */
invitationRequest.SetExtendedProperty(PidLidSharingRemoteType, "IPF.Appointment"); /* Constant Required Value [MS-OXSHARE] 2.2.3.5 */
invitationRequest.SetExtendedProperty(PidNameXSharingRemoteType, "IPF.Appointment"); /* Constant Required Value [MS-OXSHARE] 2.2.3.6 */
invitationRequest.SetExtendedProperty(PidLidSharingRemoteUid, folderidHex); /* MUST be set to PidTagEntryId of folder being shared */
invitationRequest.SetExtendedProperty(PidNameXSharingRemoteUid, folderidHex); /* Must be set to same value as PidLidSharingRemoteUid */
// Section 2.2.5
invitationRequest.SetExtendedProperty(PidNameContentClass, "Sharing"); /* Constant Required Value [MS-ProtocolSpec] */
invitationRequest.SetExtendedProperty(PidTagMessageClass, "IPM.Sharing"); /* Constant Required Value [MS-ProtocolSpec] */
// ********* ADDITIONAL MAPPED PROPERTIES IM FINDING AS I TROUBLESHOOT ********************** //
invitationRequest.SetExtendedProperty(PidTagPriority, 0); /* From troubleshooting I'm just trying to match up values that were missing */
invitationRequest.SetExtendedProperty(PidTagSensitivity, 0); /* From troubleshooting as well */
invitationRequest.SetExtendedProperty(PR_BODY_HTML, binPRBODYHTML); /* From troubleshooting OWA error pointing to serializing HTML failing */
invitationRequest.SetExtendedProperty(PR_BODY, strBODY);
invitationRequest.SetExtendedProperty(RecipientReassignmentProhibited, true); /* Because it seemed like a good idea */
// Add a file attachment by using a stream
// We need to do the following in order to prevent 3 extra bytes from being prepended to the attachment
string sharMetadata = File.ReadAllText(sharedFilePath, Encoding.ASCII);
byte[] fileContents;
UTF8Encoding encoding = new System.Text.UTF8Encoding();
fileContents = encoding.GetBytes(sharMetadata);
//fileContents = File.ReadAllBytes(sharedFilePath);
//// fileContents is a Stream object that represents the content of the file to attach.
invitationRequest.Attachments.AddFileAttachment("sharing_metadata.xml", fileContents);
////invitationRequest.Attachments.AddFileAttachment(sharedFilePath);
//// This is where we set those "special" headers and other pertinent
//// information I noted in Part 1 of this series...
//Attachment thisAttachment = invitationRequest.Attachments[0];
//thisAttachment.ContentType = "application/x-sharing-metadata-xml";
//thisAttachment.Name = "sharing_metadata.xml";
//thisAttachment.IsInline = false;
// Add recipient info and send message
invitationRequest.ToRecipients.Add(new EmailAddress() { Address = "[email protected]" });
invitationRequest.SendAndSaveCopy();
// I always end my methods by returning the EWS
// impersonated user to null to clean up
service.ImpersonatedUserId = null;
catch (Exception ex)
public String GetConvertedEWSIDinHex(ExchangeService esb, String sID, String strSMTPAdd)
// Create a request to convert identifiers.
AlternateId objAltID = new AlternateId();
objAltID.Format = IdFormat.EwsId;
objAltID.Mailbox = strSMTPAdd;
objAltID.UniqueId = sID;
//Convert PR_ENTRYID identifier format to an EWS identifier.
AlternateIdBase objAltIDBase = esb.ConvertId(objAltID, IdFormat.HexEntryId);
AlternateId objAltIDResp = (AlternateId)objAltIDBase;
return objAltIDResp.UniqueId.ToString();
public String GetInvitationMailboxId(string mailBoxServer, string domainName)
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "[email protected]");
// Generate The Store Entry Id for the impersonated user
StringBuilder MailboxIDPointer = new StringBuilder();
string fqdn = mailBoxServer;
string legacyDN = domainName;
MailboxIDPointer.Append("00000000"); /* Flags */
MailboxIDPointer.Append("38A1BB1005E5101AA1BB08002B2A56C2"); /* ProviderUID */
MailboxIDPointer.Append("00"); /* Version */
MailboxIDPointer.Append("00"); /* Flag */
MailboxIDPointer.Append("454D534D44422E444C4C00000000"); /* DLLFileName */
MailboxIDPointer.Append("00000000"); /* Wrapped Flags */
MailboxIDPointer.Append("1B55FA20AA6611CD9BC800AA002FC45A"); /* WrappedProvider UID (Mailbox Store Object) */
MailboxIDPointer.Append("0C000000"); /* Wrapped Type (Mailbox Store) */
MailboxIDPointer.Append(ConvertStringToHex(fqdn)); /* ServerShortname (FQDN) */
MailboxIDPointer.Append("00"); /* termination bit */
MailboxIDPointer.Append(ConvertStringToHex(legacyDN)); /* Returns the userDN of the impersonated user */
MailboxIDPointer.Append("00"); /* terminator bit */
service.ImpersonatedUserId = null;
return MailboxIDPointer.ToString();
static bool RedirectionUrlValidationCallback(String redirectionUrl)
bool redirectionValidated = false;
if (redirectionUrl.Equals("https://SampleUrl/autodiscover/autodiscover.xml"))
redirectionValidated = true;
return redirectionValidated;
public String GetIntiatorEntryID(string domainName)
String result = String.Empty;
//// Bind to EWS
//ExchangeService service = ExchangeConnection.ExchangeService();
//service.ImpersonatedUserId =
//new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "[email protected]");
//// Get LegacyDN Using the function above this one
string sharedByLegacyDN = domainName;
// A conversion function from earlier
string legacyDNinHex = ConvertStringToHex(sharedByLegacyDN);
StringBuilder addBookEntryId = new StringBuilder();
addBookEntryId.Append("00000000"); /* Flags */
addBookEntryId.Append("DCA740C8C042101AB4B908002B2FE182"); /* ProviderUID */
addBookEntryId.Append("01000000"); /* Version */
addBookEntryId.Append("00000000"); /* Type - 00 00 00 00 = Local Mail User */
addBookEntryId.Append(legacyDNinHex); /* Returns the userDN of the impersonated user */
addBookEntryId.Append("00"); /* terminator bit */
result = addBookEntryId.ToString();
//service.ImpersonatedUserId = null;
return result;
public string ConvertStringToHex(string input)
// Take our input and break it into an array
char[] arrInput = input.ToCharArray();
String result = String.Empty;
// For each set of characters
foreach (char element in arrInput)
if (String.IsNullOrEmpty(result))
result = String.Format("{0:X2}", Convert.ToUInt16(element)).ToString();
else
result += String.Format("{0:X2}", Convert.ToUInt16(element)).ToString();
return result.ToString();
public string CreateSharingMessageAttachment(string folderid, string userSharing, string userSharingEntryID, string invitationMailboxID, string userSharedTo, string dataType, string calendarName)
XmlDocument sharedMetadataXML = new XmlDocument();
string sharedMetaDataFilePath = string.Empty;
try
// Create a String that contains our new sharing_metadata.xml file
StringBuilder metadataString = new StringBuilder("<?xml version=\"1.0\"?>");
metadataString.Append("<SharingMessage xmlns=\"http://schemas.microsoft.com/sharing/2008\">");
metadataString.Append("<DataType>" + dataType + "</DataType>");
metadataString.Append("<Initiator>");
metadataString.Append("<Name>" + userSharing + "</Name>");
metadataString.Append("<SmtpAddress>" + "[email protected]" + "</SmtpAddress><EntryId>" + userSharingEntryID.Trim());
metadataString.Append("</EntryId>");
metadataString.Append("</Initiator>");
metadataString.Append("<Invitation>");
metadataString.Append("<Title>" + calendarName + "</Title>");
metadataString.Append("<Providers>");
metadataString.Append("<Provider Type=\"ms-exchange-internal\" TargetRecipients=\"" + userSharedTo + "\">");
metadataString.Append("<FolderId xmlns=\"http://schemas.microsoft.com/exchange/sharing/2008\">");
metadataString.Append(folderid);
metadataString.Append("</FolderId>");
metadataString.Append("<MailboxId xmlns=\"http://schemas.microsoft.com/exchange/sharing/2008\">");
metadataString.Append(invitationMailboxID);
metadataString.Append("</MailboxId>");
metadataString.Append("</Provider>");
metadataString.Append("</Providers>");
metadataString.Append("</Invitation>");
metadataString.Append("</SharingMessage>");
sharedMetadataXML.LoadXml(metadataString.ToString());
string tempPath = System.IO.Path.GetTempPath();
sharedMetaDataFilePath = tempPath + "sharing_metadata.xml";
sharedMetadataXML.Save(sharedMetaDataFilePath);
catch (Exception eg)
throw eg;
return sharedMetaDataFilePath;
public Dictionary<string, string> GetUserSettings(AutodiscoverService autodiscoverService)
GetUserSettingsResponse userresponse = autodiscoverService.GetUserSettings(
"[email protected]",
UserSettingName.UserDisplayName,
UserSettingName.InternalMailboxServerDN,
UserSettingName.UserDN
Dictionary<string, string> myUserSettings = new Dictionary<string, string>();
foreach (KeyValuePair<UserSettingName, Object> usersetting in userresponse.Settings)
if (usersetting.Key.ToString() == "InternalMailboxServerDN")
int lastIndexOfEqual = usersetting.Value.ToString().LastIndexOf("=");
string subString = usersetting.Value.ToString().Substring(lastIndexOfEqual + 1);
string value = subString;
myUserSettings.Add("InternalMailboxServer", value.ToString());
if (usersetting.Key.ToString() == "UserDisplayName")
string[] arrResult = usersetting.Value.ToString().Split('.');
myUserSettings.Add("UserDisplayName", arrResult[0].ToString());
if (usersetting.Key.ToString() == "UserDN")
string[] arrResult = usersetting.Value.ToString().Split('.');
myUserSettings.Add("UserDN", arrResult[0].ToString());
return myUserSettings;
private static byte[] HexStringToByteArray(string input)
byte[] Bytes;
int ByteLength;
string HexValue = "\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9|||||||\xA\xB\xC\xD\xE\xF";
ByteLength = input.Length / 2;
Bytes = new byte[ByteLength];
for (int x = 0, i = 0; i < input.Length; i += 2, x += 1)
Bytes[x] = (byte)(HexValue[Char.ToUpper(input[i + 0]) - '0'] << 4);
Bytes[x] |= (byte)(HexValue[Char.ToUpper(input[i + 1]) - '0']);
return Bytes;Hi,
I'm trying to share a calendar through ews managed api v.2 and using exchange 2013 version.
i'm preparing a shared calendar and providing values to extended properties .
Here comes the problem when i'm trying to send the sharing request(email message)
The following is code snippet.
public void ShareCalendar(Calendar calendar)
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
service.Credentials = new NetworkCredential("user1", "password", "domain");
service.Url = new Uri("https://sampleUrl/ews/exchange.asmx");
try
// Bind to the folder
//Folder folderStoreInfo;
//folderStoreInfo = Folder.Bind(service, calendar.ExchangeId);
//string EwsID = folderStoreInfo.Id.UniqueId;
string EwsID = calendar.FolderExchangeId;
// The value of folderidHex will be what we need to use for the FolderId in the xml file
AutodiscoverService autoDiscover = new AutodiscoverService(ExchangeVersion.Exchange2013);
autoDiscover.Credentials = new NetworkCredential("user1", "password", "domain");
autoDiscover.RedirectionUrlValidationCallback = RedirectionUrlValidationCallback;
Dictionary<string, string> userSettings = GetUserSettings(autoDiscover);
string folderidHex = GetConvertedEWSIDinHex(service, EwsID, "[email protected]");
string domainName = string.Empty;
string mailBoxServer = string.Empty;
string userName = string.Empty;
foreach (var item in userSettings)
switch (item.Key)
case "UserDN":
domainName = item.Value.ToString();
break;
case "InternalMailboxServer":
mailBoxServer = item.Value.ToString();
break;
case "UserDisplayName":
userName = item.Value.ToString();
break;
string entryId = GetIntiatorEntryID(domainName);
string mailboxId = GetInvitationMailboxId(mailBoxServer, domainName);
string sharedFilePath = CreateSharingMessageAttachment(folderidHex, userName, entryId, mailboxId, "[email protected]", "calendar", calendar.FolderName);
// Create a new message
EmailMessage invitationRequest = new EmailMessage(service);
invitationRequest.Subject = "I'd like to share my calendar with you";
invitationRequest.Body = "Sent by Exchange Administrator on behalf of user";
//invitationRequest.Culture = "en-US";
invitationRequest.Sensitivity = Sensitivity.Normal;
// Set a sharing specific property on the message
invitationRequest.ItemClass = "IPM.Sharing"; /* Constant Required Value [MS-ProtocolSpec] */
byte[] byteEntryId = HexStringToByteArray(entryId);
// This is the Guid of the Sharing Provider in Exchange, and it's value does not change
Guid binSharingProviderGuid = new Guid("{AEF00600-0000-0000-C000-000000000046}");
// Even though I don't think setting this property is mandatory,
// it just seemed like the right thing to do and it works so I \
// ain't messin with it!
byte[] byteSharingProviderGuid = binSharingProviderGuid.ToByteArray();
string strPRBODYHTML = "<html dir=\"ltr\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n<meta name=\"GENERATOR\"
content=\"MSHTML 8.00.7601.17514\">\r\n<style id=\"owaParaStyle\">P {\r\n MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px \r\n}\r\n</style>\r\n</head>\r\n<body fPStyle=\"1\" ocsi=\"0\">\r\n<tt>\r\n<pre>SharedByUserDisplayName
(SharedByUserSmtpAddress) has invited you to view his or her Microsoft Exchange Calendar.\r\n\r\nFor instructions on how to view shared folders on Exchange, see the following article:\r\n\r\nhttp://go.microsoft.com/fwlink/?LinkId=57561\r\n\r\n*~*~*~*~*~*~*~*~*~*\r\n\r\n</pre>\r\n</tt>\r\n<div>\r\n<div
style=\"direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;\">this is a test message</div>\r\n</div>\r\n</body>\r\n</html>\r\n";
string strBODY = @"
SharedByUserDisplayName (SharedByUserSmtpAddress) has invited you to view his or
her Microsoft Exchange Calendar.
For instructions on how to view shared folders on Exchange, see the
following article:
http://go.microsoft.com/fwlink/?LinkId=57561
*~*~*~*~*~*~*~*~*~*
test body
// Convert these to hex and binary equivelants to assign to their relevant
// extended properties
string hexPRBODYHTML = ConvertStringToHex(strPRBODYHTML);
byte[] binPRBODYHTML = HexStringToByteArray(hexPRBODYHTML);
Guid PropertySetSharing = Guid.Parse("00062040-0000-0000-C000-000000000046");//constant
Guid PropertySetInternetHeaders = Guid.Parse("00020386-0000-0000-C000-000000000046");//constant
ExtendedPropertyDefinition PidLidSharingProviderGuidProperty = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A01, MapiPropertyType.CLSID);
ExtendedPropertyDefinition ConversationIdProperty = new ExtendedPropertyDefinition(0x3013, MapiPropertyType.Binary);
// Sharing Properties (in order of reference according to protocol examples in: [MS-OXSHARE])
// Additional Property Constraints
// [MS-OXSHARE] 2.2.5.2
ExtendedPropertyDefinition PidTagMessageClass = new ExtendedPropertyDefinition(0x001A, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.5.1
//ExtendedPropertyDefinition PidNameContentClass = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "Content-Class", MapiPropertyType.String);
ExtendedPropertyDefinition PidNameContentClass = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "Content-class", MapiPropertyType.String);
// Common Message Object Properties
// [MS-OXSHARE] 2.2.1
ExtendedPropertyDefinition PidTagNormalizedSubject = new ExtendedPropertyDefinition(0x0E1D, MapiPropertyType.String);
// The PidTagSubjectPrefix is a zero-length string, so I do not set it
// ExtendedPropertyDefinition PidTagSubjectPrefix = new ExtendedPropertyDefinition(0x003D, MapiPropertyType.String);
// Sharing Object Message Properties
// [MS-OXSHARE] 2.2.2.12
ExtendedPropertyDefinition PidLidSharingProviderGuid = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A01, MapiPropertyType.Binary);
// [MS-OXSHARE] 2.2.2.13
ExtendedPropertyDefinition PidNameXSharingProviderGuid = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Provider-GUID", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.14
ExtendedPropertyDefinition PidLidSharingProviderName = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A02, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.15
ExtendedPropertyDefinition PidNameXSharingProviderName = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Provider-Name", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.16
ExtendedPropertyDefinition PidLidSharingProviderUrl = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A03, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.17
ExtendedPropertyDefinition PidNameXSharingProviderUrl = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Provider-URL", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.5
ExtendedPropertyDefinition PidLidSharingFlavor = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A18, MapiPropertyType.Integer);
// [MS-OXSHARE] 2.2.2.6
ExtendedPropertyDefinition PidNameXSharingFlavor = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Flavor", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.1
ExtendedPropertyDefinition PidLidSharingCapabilities = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A17, MapiPropertyType.Integer);
// [MS-OXSHARE] 2.2.2.2
ExtendedPropertyDefinition PidNameXSharingCapabilities = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Capabilities", MapiPropertyType.String);
// Sections 2.3 and 2.4 are also zero-length strings, so I won't set those either
// [MS-OXSHARE] 2.2.2.3
// ExtendedPropertyDefinition PidLidSharingConfigurationUrl = new //ExtendedPropertyDefinition(PropertySetSharing, 0x8A24, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.4
//ExtendedPropertyDefinition PidNameXSharingConfigUrl = new //ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "X-Sharing-Config-Url", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.10
ExtendedPropertyDefinition PidLidSharingLocalType = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A14, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.11
ExtendedPropertyDefinition PidNameXSharingLocalType = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Local-Type", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.7
ExtendedPropertyDefinition PidLidSharingInitiatorEntryId = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A09, MapiPropertyType.Binary);
// [MS-OXSHARE] 2.2.2.8
ExtendedPropertyDefinition PidLidSharingInitiatorName = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A07, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.2.9
ExtendedPropertyDefinition PidLidSharingInitiatorSMTP = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A08, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.1
ExtendedPropertyDefinition PidLidSharingRemoteName = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A05, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.2
ExtendedPropertyDefinition PidNameXSharingRemoteName = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Name", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.5
ExtendedPropertyDefinition PidLidSharingRemoteType = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A1D, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.6
ExtendedPropertyDefinition PidNameXSharingRemoteType = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Type", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.7
ExtendedPropertyDefinition PidLidSharingRemoteUid = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A06, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.8
ExtendedPropertyDefinition PidNameXSharingRemoteUid = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Uid", MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.3
ExtendedPropertyDefinition PidLidSharingRemoteStoreUid = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A48, MapiPropertyType.String);
// [MS-OXSHARE] 2.2.3.4
ExtendedPropertyDefinition PidNameXSharingRemoteStoreUid = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Store-Uid", MapiPropertyType.String);
//From troubleshooting I noticed I was missing
ExtendedPropertyDefinition PidTagPriority = new ExtendedPropertyDefinition(0x0026, MapiPropertyType.Integer);
ExtendedPropertyDefinition PidTagSensitivity = new ExtendedPropertyDefinition(0x0036, MapiPropertyType.Integer);
ExtendedPropertyDefinition PR_BODY_HTML = new ExtendedPropertyDefinition(0x1013, MapiPropertyType.Binary); //PR_BOD
ExtendedPropertyDefinition PR_BODY = new ExtendedPropertyDefinition(0x1000, MapiPropertyType.String);
ExtendedPropertyDefinition RecipientReassignmentProhibited = new ExtendedPropertyDefinition(0x002b, MapiPropertyType.Boolean);
// Section 2.2.1
invitationRequest.SetExtendedProperty(PidTagNormalizedSubject, "I'd like to share my calendar with you"); /* Constant Required Value [MS-OXSHARE] 2.2.1 */
//invitationRequest.SetExtendedProperty(PidTagSubjectPrefix, String.Empty); /* Constant Required Value [MS-OXSHARE] 2.2.1 */
// Section 2.2.2
invitationRequest.SetExtendedProperty(PidLidSharingCapabilities, 0x40220); /* value for Special Folders */
invitationRequest.SetExtendedProperty(PidNameXSharingCapabilities, "40220"); /* Test representation of SharingCapabilities value */
//invitationRequest.SetExtendedProperty(PidLidSharingConfigurationUrl, String.Empty); /* Zero-Length String [MS-OXSHARE] 2.2.2.3 */
//invitationRequest.SetExtendedProperty(PidNameXSharingConfigUrl, String.Empty); /* Zero-Length String [MS-OXSHARE] 2.2.2.4 */
invitationRequest.SetExtendedProperty(PidLidSharingFlavor, 0x20310); /* Indicates Invitation for a special folder [MS-OXSHARE] 2.2.2.5 */
invitationRequest.SetExtendedProperty(PidNameXSharingFlavor, "20310"); /* Text representation of SharingFlavor value [MS-OXSHARE] 2.2.2.6 */
invitationRequest.SetExtendedProperty(PidLidSharingInitiatorEntryId, byteEntryId); /* Value from the Initiator/EntryId value in the Sharing Message attachment .xml document */
invitationRequest.SetExtendedProperty(PidLidSharingInitiatorSMTP, "[email protected]"); /* Value from Initiator/Smtp Address in the Sharing message attachment .xml document */
invitationRequest.SetExtendedProperty(PidLidSharingInitiatorName, "User1"); /* Value from Initiator/Name Address in the Sharing message attachment .xml document */
invitationRequest.SetExtendedProperty(PidLidSharingLocalType, "IPF.Appointment"); /* MUST be set to PidTagContainerClass of folder to be shared */
invitationRequest.SetExtendedProperty(PidNameXSharingLocalType, "IPF.Appointment"); /* MUST be set to same value as PidLidSharingLocalType */
invitationRequest.SetExtendedProperty(PidLidSharingProviderGuid, byteSharingProviderGuid); /* Constant Required Value [MS-OXSHARE] 2.2.2.12 */
invitationRequest.SetExtendedProperty(PidNameXSharingProviderGuid, "AEF0060000000000C000000000000046"); /* Constant Required Value [MS-OXSHARE] 2.2.2.13 */
invitationRequest.SetExtendedProperty(PidLidSharingProviderName, "Microsoft Exchange"); /* Constant Required Value [MS-OXSHARE] 2.2.2.14 */
invitationRequest.SetExtendedProperty(PidNameXSharingProviderName, "Microsoft Exchange"); /* Constant Required Value [MS-OXSHARE] 2.2.2.15] */
invitationRequest.SetExtendedProperty(PidLidSharingProviderUrl, "http://www.microsoft.com/exchange"); /* Constant Required Value [MS-OXSHARE] 2.2.2.16 */
invitationRequest.SetExtendedProperty(PidNameXSharingProviderUrl, "http://www.microsoft.com/exchange"); /* Constant Required Value [MS-OXSHARE] 2.2.2.17 */
// Section 2.2.3
invitationRequest.SetExtendedProperty(PidLidSharingRemoteName, calendar.FolderName); /* MUST be set to PidTagDisplayName of the folder being shared */
invitationRequest.SetExtendedProperty(PidNameXSharingRemoteName, calendar.FolderName); /* MUST be set to same value as PidLidSharingRemoteName */
invitationRequest.SetExtendedProperty(PidLidSharingRemoteStoreUid, mailboxId); /* Must be set to PidTagStoreEntryId of the folder being shared */
invitationRequest.SetExtendedProperty(PidNameXSharingRemoteStoreUid, mailboxId); /* MUST be set to same value as PidLidSharingRemoteStoreUid */
invitationRequest.SetExtendedProperty(PidLidSharingRemoteType, "IPF.Appointment"); /* Constant Required Value [MS-OXSHARE] 2.2.3.5 */
invitationRequest.SetExtendedProperty(PidNameXSharingRemoteType, "IPF.Appointment"); /* Constant Required Value [MS-OXSHARE] 2.2.3.6 */
invitationRequest.SetExtendedProperty(PidLidSharingRemoteUid, folderidHex); /* MUST be set to PidTagEntryId of folder being shared */
invitationRequest.SetExtendedProperty(PidNameXSharingRemoteUid, folderidHex); /* Must be set to same value as PidLidSharingRemoteUid */
// Section 2.2.5
invitationRequest.SetExtendedProperty(PidNameContentClass, "Sharing"); /* Constant Required Value [MS-ProtocolSpec] */
invitationRequest.SetExtendedProperty(PidTagMessageClass, "IPM.Sharing"); /* Constant Required Value [MS-ProtocolSpec] */
// ********* ADDITIONAL MAPPED PROPERTIES IM FINDING AS I TROUBLESHOOT ********************** //
invitationRequest.SetExtendedProperty(PidTagPriority, 0); /* From troubleshooting I'm just trying to match up values that were missing */
invitationRequest.SetExtendedProperty(PidTagSensitivity, 0); /* From troubleshooting as well */
invitationRequest.SetExtendedProperty(PR_BODY_HTML, binPRBODYHTML); /* From troubleshooting OWA error pointing to serializing HTML failing */
invitationRequest.SetExtendedProperty(PR_BODY, strBODY);
invitationRequest.SetExtendedProperty(RecipientReassignmentProhibited, true); /* Because it seemed like a good idea */
// Add a file attachment by using a stream
// We need to do the following in order to prevent 3 extra bytes from being prepended to the attachment
string sharMetadata = File.ReadAllText(sharedFilePath, Encoding.ASCII);
byte[] fileContents;
UTF8Encoding encoding = new System.Text.UTF8Encoding();
fileContents = encoding.GetBytes(sharMetadata);
//fileContents = File.ReadAllBytes(sharedFilePath);
//// fileContents is a Stream object that represents the content of the file to attach.
invitationRequest.Attachments.AddFileAttachment("sharing_metadata.xml", fileContents);
////invitationRequest.Attachments.AddFileAttachment(sharedFilePath);
//// This is where we set those "special" headers and other pertinent
//// information I noted in Part 1 of this series...
//Attachment thisAttachment = invitationRequest.Attachments[0];
//thisAttachment.ContentType = "application/x-sharing-metadata-xml";
//thisAttachment.Name = "sharing_metadata.xml";
//thisAttachment.IsInline = false;
// Add recipient info and send message
invitationRequest.ToRecipients.Add(new EmailAddress() { Address = "[email protected]" });
invitationRequest.SendAndSaveCopy();
// I always end my methods by returning the EWS
// impersonated user to null to clean up
service.ImpersonatedUserId = null;
catch (Exception ex)
public String GetConvertedEWSIDinHex(ExchangeService esb, String sID, String strSMTPAdd)
// Create a request to convert identifiers.
AlternateId objAltID = new AlternateId();
objAltID.Format = IdFormat.EwsId;
objAltID.Mailbox = strSMTPAdd;
objAltID.UniqueId = sID;
//Convert PR_ENTRYID identifier format to an EWS identifier.
AlternateIdBase objAltIDBase = esb.ConvertId(objAltID, IdFormat.HexEntryId);
AlternateId objAltIDResp = (AlternateId)objAltIDBase;
return objAltIDResp.UniqueId.ToString();
public String GetInvitationMailboxId(string mailBoxServer, string domainName)
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "[email protected]");
// Generate The Store Entry Id for the impersonated user
StringBuilder MailboxIDPointer = new StringBuilder();
string fqdn = mailBoxServer;
string legacyDN = domainName;
MailboxIDPointer.Append("00000000"); /* Flags */
MailboxIDPointer.Append("38A1BB1005E5101AA1BB08002B2A56C2"); /* ProviderUID */
MailboxIDPointer.Append("00"); /* Version */
MailboxIDPointer.Append("00"); /* Flag */
MailboxIDPointer.Append("454D534D44422E444C4C00000000"); /* DLLFileName */
MailboxIDPointer.Append("00000000"); /* Wrapped Flags */
MailboxIDPointer.Append("1B55FA20AA6611CD9BC800AA002FC45A"); /* WrappedProvider UID (Mailbox Store Object) */
MailboxIDPointer.Append("0C000000"); /* Wrapped Type (Mailbox Store) */
MailboxIDPointer.Append(ConvertStringToHex(fqdn)); /* ServerShortname (FQDN) */
MailboxIDPointer.Append("00"); /* termination bit */
MailboxIDPointer.Append(ConvertStringToHex(legacyDN)); /* Returns the userDN of the impersonated user */
MailboxIDPointer.Append("00"); /* terminator bit */
service.ImpersonatedUserId = null;
return MailboxIDPointer.ToString();
static bool RedirectionUrlValidationCallback(String redirectionUrl)
bool redirectionValidated = false;
if (redirectionUrl.Equals("https://SampleUrl/autodiscover/autodiscover.xml"))
redirectionValidated = true;
return redirectionValidated;
public String GetIntiatorEntryID(string domainName)
String result = String.Empty;
//// Bind to EWS
//ExchangeService service = ExchangeConnection.ExchangeService();
//service.ImpersonatedUserId =
//new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "[email protected]");
//// Get LegacyDN Using the function above this one
string sharedByLegacyDN = domainName;
// A conversion function from earlier
string legacyDNinHex = ConvertStringToHex(sharedByLegacyDN);
StringBuilder addBookEntryId = new StringBuilder();
addBookEntryId.Append("00000000"); /* Flags */
addBookEntryId.Append("DCA740C8C042101AB4B908002B2FE182"); /* ProviderUID */
addBookEntryId.Append("01000000"); /* Version */
addBookEntryId.Append("00000000"); /* Type - 00 00 00 00 = Local Mail User */
addBookEntryId.Append(legacyDNinHex); /* Returns the userDN of the impersonated user */
addBookEntryId.Append("00"); /* terminator bit */
result = addBookEntryId.ToString();
//service.ImpersonatedUserId = null;
return result;
public string ConvertStringToHex(string input)
// Take our input and break it into an array
char[] arrInput = input.ToCharArray();
String result = String.Empty;
// For each set of characters
foreach (char element in arrInput)
if (String.IsNullOrEmpty(result))
result = String.Format("{0:X2}", Convert.ToUInt16(element)).ToString();
else
result += String.Format("{0:X2}", Convert.ToUInt16(element)).ToString();
return result.ToString();
public string CreateSharingMessageAttachment(string folderid, string userSharing, string userSharingEntryID, string invitationMailboxID, string userSharedTo, string dataType, string calendarName)
XmlDocument sharedMetadataXML = new XmlDocument();
string sharedMetaDataFilePath = string.Empty;
try
// Create a String that contains our new sharing_metadata.xml file
StringBuilder metadataString = new StringBuilder("<?xml version=\"1.0\"?>");
metadataString.Append("<SharingMessage xmlns=\"http://schemas.microsoft.com/sharing/2008\">");
metadataString.Append("<DataType>" + dataType + "</DataType>");
metadataString.Append("<Initiator>");
metadataString.Append("<Name>" + userSharing + "</Name>");
metadataString.Append("<SmtpAddress>" + "[email protected]" + "</SmtpAddress><EntryId>" + userSharingEntryID.Trim());
metadataString.Append("</EntryId>");
metadataString.Append("</Initiator>");
metadataString.Append("<Invitation>");
metadataString.Append("<Title>" + calendarName + "</Title>");
metadataString.Append("<Providers>");
metadataString.Append("<Provider Type=\"ms-exchange-internal\" TargetRecipients=\"" + userSharedTo + "\">");
metadataString.Append("<FolderId xmlns=\"http://schemas.microsoft.com/exchange/sharing/2008\">");
metadataString.Append(folderid);
metadataString.Append("</FolderId>");
metadataString.Append("<MailboxId xmlns=\"http://schemas.microsoft.com/exchange/sharing/2008\">");
metadataString.Append(invitationMailboxID);
metadataString.Append("</MailboxId>");
metadataString.Append("</Provider>");
metadataString.Append("</Providers>");
metadataString.Append("</Invitation>");
metadataString.Append("</SharingMessage>");
sharedMetadataXML.LoadXml(metadataString.ToString());
string tempPath = System.IO.Path.GetTempPath();
sharedMetaDataFilePath = tempPath + "sharing_metadata.xml";
sharedMetadataXML.Save(sharedMetaDataFilePath);
catch (Exception eg)
throw eg;
return sharedMetaDataFilePath;
public Dictionary<string, string> GetUserSettings(AutodiscoverService autodiscoverService)
GetUserSettingsResponse userresponse = autodiscoverService.GetUserSettings(
"[email protected]",
UserSettingName.UserDisplayName,
UserSettingName.InternalMailboxServerDN,
UserSettingName.UserDN
Dictionary<string, string> myUserSettings = new Dictionary<string, string>();
foreach (KeyValuePair<UserSettingName, Object> usersetting in userresponse.Settings)
if (usersetting.Key.ToString() == "InternalMailboxServerDN")
int lastIndexOfEqual = usersetting.Value.ToString().LastIndexOf("=");
string subString = usersetting.Value.ToString().Substring(lastIndexOfEqual + 1);
string value = subString;
myUserSettings.Add("InternalMailboxServer", value.ToString());
if (usersetting.Key.ToString() == "UserDisplayName")
string[] arrResult = usersetting.Value.ToString().Split('.');
myUserSettings.Add("UserDisplayName", arrResult[0].ToString());
if (usersetting.Key.ToString() == "UserDN")
string[] arrResult = usersetting.Value.ToString().Split('.');
myUserSettings.Add("UserDN", arrResult[0].ToString());
return myUserSettings;
private static byte[] HexStringToByteArray(string input)
byte[] Bytes;
int ByteLength;
string HexValue = "\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9|||||||\xA\xB\xC\xD\xE\xF";
ByteLength = input.Length / 2;
Bytes = new byte[ByteLength];
for (int x = 0, i = 0; i < input.Length; i += 2, x += 1)
Bytes[x] = (byte)(HexValue[Char.ToUpper(input[i + 0]) - '0'] << 4);
Bytes[x] |= (byte)(HexValue[Char.ToUpper(input[i + 1]) - '0']);
return Bytes;
am i missing anything
any help is appreciated
Thanks in advance -
Get list of User Mailboxes in Exchange server 2013 by using EWS managed API
Hi all,
I need list of Users exists in my Exchange server 2013 , i.e Mail Box Users log in name.
i know the command in Powershell to get list, but i need this using code[ ews managed API].
How can i achieve this ?
Please share your ideasHi Glen,
i follow your suggested links i wrote below code ,
here i am getting error
The term 'Get-Users' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
SecureString password = new SecureString();
string str_password = "EIS2014!@#";
string username = "[email protected]";
foreach (char x in str_password) { password.AppendChar(x); }
PSCredential credential = new PSCredential(username, password);
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("http://ExchangeServer.admin.com/powershell"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential);
//connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo);
PowerShell powershell = PowerShell.Create();
PSCommand command = new PSCommand();
command.AddCommand("Get-Users");
command.AddParameter("ResultSize", 50);
powershell.Commands = command;
runspace.Open();
powershell.Runspace = runspace;
var aa = powershell.Invoke();
Please help me. -
Displaying content item -(IContentItem) in portlet using Content Server API
Hi,
I am using the latest Content server API in my remote server to get the published content items. I have to display the content item in the JSP portlet.
So how to display the content item in the portlet, if you have the IContentItem Object retrieved from the content server ? Is there any mechanism to get the HTML code/JSP code that corresponds to the IContentItem object?(All the content item will be an html or jsp )
Currently we are extracting the publish url and opening an http connection to retrieve the html, which is not a good solution if you have mutiple portlets in the same page. So please suggest how can I display the content item (IContentItem Object) in the portlet.?Hi Anand,
I am facing the same problem on IBM WebSphere Portal 5.1.
Did you find a solution to your problem ?
Thanks
Ganesh -
Hi,
I want to use public API to add items to content areas. However this API ( wwsbr_api) seems only work when user is Portal30. When i try to run this API with other user it fails.
i've run the script sbrapi.sql to add some grant to the user.
This is the command that i'm trying to run with a database user that is diferent from portal30
declare
id number;
begin
ID := portal30.wwsbr_api.add_content_area
p_name => 'ENTERTAINMENT',
p_display_name => 'Entertainment Site',
p_versioning => portal30.wwsbr_api.VERSIONING_AUDIT,
p_default_language => 'us',
p_logo_filename => 'c:\temp\confirmar.gif'
end;
This is the error that is raised ..
The following error has occurred:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "PORTAL30.WWSBR_API", line 32
ORA-06512: at line 4
i'll apreciate some help
Thanks
Pedro RibeiroI forgot some info ...
I'm using Portal 3.0.8 in a 8.1.7 database
Platform is Windows Nt -
Hi all,
We have few thousand contents in our content repository. I have developed code using CM API to checkout and approve them one by one and check-in back into the repository.
But it fails after approving few hundred contents, with timeout exception.
What is the way to overcome this?.
Regards,
Bharat.Hi Bharat,
You could do a couple of things here - the easiest would be to increase your JTA timeout value, but you may also just chunk the work you're doing into more manageable pieces so you don't exceed the timeout value. For example, you could do this check-in over different areas of your node hierarchy at a time.
If you have the use-case to automatically publish newly created content you could write an event listener to do so.
Let me know if this helps or if your use case is different.
-Ryan -
Using Content Manager with OLS - Oracle Label Security
There are two entries in this forum with OLS - the last one in 2005.
Has any one successfully deployed UCM with OLS?
Thanks,
PaulYes I have with 10gr3
It can be made to work but perhaps not in the way you want (per user?). Your label security will need to have policies based on something.
I did a proof of concept using Security Group column as the 'label'. Then applied VPD policies based on which network the request came from (1 DB rac node in each network).
In my case I wanted to show ALL content to a secure network but a subset of content to the lower security network. For this use case it is ideal.
It worked flawlessly...not supported though
Apparently OLS is on roadmap or UCM (WCC) so ask Oracle and see if you can find out if it is slated for any particular release yet.
Tim -
Localization using content management
I store localized content in the content repository. For e.g. a Hotel review (some text and a picture) typically a html snip, is translated into multiple languages.
What is the best practice to store and retrieve the localized content.
1. Defining a locale attribute for the type and searching on the locale attribute as well?
2. Organizing the content repository some thing like, "rep/hotels/reviews/en_US". IMO This option doesnt lend itself to a search in a content selector etc.,
Also like resource bundles , is there any mechanism to fall back to a default locale if the specific locale is not present?
Thanks
CSHi CS,
There are several ways to do this, including:
a- one repository per locale
b- separate by locale near the top of the content tree
c- each node has associated locale metadata
(a) and (b) are beneficial in that the search space can be narrowed quickly. These will probably be most efficient, and will probably work better with propagation.
btw- I believe a content selector can search by path -- search using the cm_path system property.
At the present time, CM does not have any predefined mechanisms for organizing by locale or for providing defaults; this is something each application can select how to do best (and what level of granularity to support). -
I am developing C# .NET Framework 4.5 Windows Form application using EWS Managed API 1.2 with Exchange Server 2007 which performs some sort of syncing of mails.
Now that I am dealing with Extended Properties, I want to be clear some things:
Q1. What is the purpose of DefaultExtendedPropertySet class?
MSDN says "Defines
the default sets of extended properties."
Is it just to group the extended properties?
If yes, why is the grouping there at first place?
Do we have any Ews API method which can fetch values of all extended properties belonging to the same group on an item?
Q2. I am unable to decide whether should I use custom GUID or DefaultExtendedPropertySet.PublicStrings while
constructing ExtendedPropertyDefinition:
ExtendedPropertyDefinition MyXProp = new ExtendedPropertyDefinition(
DefaultExtendedPropertySet.PublicStrings,
"MyXProp", MapiPropertyType.String);
OR
Guid MyPropertySetId = new Guid("{C11FF724-AA03-4555-9952-FA248A11C3E}");
ExtendedPropertyDefinition extendedPropertyDefinition = new ExtendedPropertyDefinition(
MyPropertySetId, "MyXProp", MapiPropertyType.String);
What are the factors that should dictate the above decision?
Also what difference it makes by above two approaches?1. Have a read of
http://blogs.technet.com/b/exchange/archive/2009/04/06/3407221.aspx which explains the history and why's and what's of named properties.
>>Do we have any Ews API method which can fetch values of all extended properties belonging to the same group on an item?
No EWS will only return the properties you ask it to return there is no way to enumerate all the extended properties on an Item.
2. There is no right or wrong answer to this using PS_PUBLIC_STRINGS with a generic propertyname is generally a bad idea because another product could decide to use the same propertyname and you have a clash. So using your own guid can have
it's advantages. Personally I find working with PS_PUBLIC_STRINGS make things more discoverable and easier to use if you need to integrate further with MAPI or Transport Agents.
Cheers
Glen
Maybe you are looking for
-
Windows 7 Clean Install on SSD
I have an X60 Tablet and a W700ds both with Lenovo OEM Samsung SSDs installed. I'd like to install WIndows 7 64 on the W700 and WIndows 7 32 on the X60 Tablet. I have read a bit about SSDs needing to be formatted and the OS needing to be installed
-
10.7.5 update progress bar "upgrading iCal calendars"
I completed the 10.7.5 update on my MacBook Pro (2011) about ten minutes ago. Since then, after opening iCal, the progress bar "upgrading iCal calendars" has been sitting here. I do have a lot of historical calendar data, going back to 2003. Has anyo
-
Moving information from last name field into blank first name field?
Is there a script (or does anyone know how I can make a workflow in Automator) for moving information from the last name field in Addressbook to the first name field (which is currently blank)? I want to move information from the last name field to t
-
Upgrade, or update catalog in LR2.1
I've just installed and then loaded LR 2.1. I now have a window asking me, do I want to, "Upgrade the Lightroom 1 Catalog, named "Lightroom Catalog"? OR, do I want to "Create a new Lightroom 2 catalog"? What should I do? What advantages/disadvantages
-
cuando exporto videos a h264 los fps no salen Constant salen variable en la vercion 7.0 salia bien en Constant pero en la 7.2.1 salen variable hay alguna forma de arreglar esto