Microsoft Exchange Server: This Property was requested, but it was not returned by server (EWS) - exchange-server

I'm trying to get the value of a bool property Exchange Web Service "IsMeeting" using C#. I define the following properties in PropertySet object:
PropertySet propertySet = new PropertySet(ItemSchema.Subject,
AppointmentSchema.AppointmentState,
AppointmentSchema.Start,
AppointmentSchema.End,
AppointmentSchema.Organizer,
AppointmentSchema.IsMeeting,
AppointmentSchema.IsCancelled,
AppointmentSchema.IsRecurring,
AppointmentSchema.IsAllDayEvent,
AppointmentSchema.LegacyFreeBusyStatus,
ItemSchema.LastModifiedTime,
AppointmentSchema.TimeZone,
AppointmentSchema.MeetingRequestWasSent,
AppointmentSchema.ICalUid,
ItemSchema.Id);
However, when trying to get properties:
foreach (Appointment a in appointments)
{
Console.WriteLine(a.IsMeeting.ToString());
}
an exception occurs "ServiceObjectPropertyException". This Property was requested, but it was not returned by server.
A similar problem was with the IsCancelled property. Adding the AppointmentState property to the PropertySet helped.
With the IsMeeting property, there are no solution ideas. I will be glad if someone can tell me. Thanks.

Only a subset of properties are returned by FindItems because of performance reasons. If you really want that property then you need to make and additional GetItem (or Bind) request on the Item. If your using the EWS Managed API you can do that with LoadPropertiesForItems see https://learn.microsoft.com/en-us/dotnet/api/microsoft.exchange.webservices.data.exchangeservice.loadpropertiesforitems?view=exchange-ews-api&WT.mc_id=DOP-MVP-10145
You should also be able to just use AppointmentState which should return 0x0001 for a Meeting

Related

How to import a document in UCM using ridc

I am trying to import a archived document that was checked-in earlier, but I want to import it using RIDC program, following is the code I am working on:
IdcClientManager manager = new IdcClientManager();
IdcClient idcClient= manager.createClient("http://localhost/idc/idcplg");
IdcContext idcContext = new IdcContext("sysadmin", "idc");
// get the binder
DataBinder binder = idcClient.createBinder();
//populate the binder with the parameters
binder.putLocal("IdcService", "IMPORT_DOCUMENT");
binder.putLocal("Idc_Name", "idc");
binder.putLocal("aArchiveName", "idc//test1");
binder.putLocal("dDocName", "000022");
binder.putLocal("dCollectionName", "test_checkin");
ServiceResponse response = idcClient.sendRequest(idcContext, binder);
DataBinder binderResult = response.getResponseAsBinder();
But I am getting the following error:
Unable to execute service IMPORT_DOCUMENT and function executeArchiveMethod.
(System Error: The collection name must be specified.)
I specified dCollectionID, dCollectionName,dCollectionLocation, but faced same result.
Can anyone guide me about this error, or where I am getting wrong in implementing this code.
For better understanding I would like to tell that the specified document was earlier checked in using WebDAV.
Any kind of help will be grateful.
Parameters are case-sensitive. You need to use IDC_Name.

Aws integration spring: Extend Visibility Timeout

Is it possible to extend the visibility time out of a message that is in flight.
See:
http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html.
Section: Changing a Message's Visibility Timeout.
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/sqs/AmazonSQSClient.html#changeMessageVisibility-com.amazonaws.services.sqs.model.ChangeMessageVisibilityRequest-
In summary I want to be able to extend the first set visibility timeout for a given message that is in flight.
Example if 15secs have passed I then want to extend the timeout by another 20secs. Better example in java docs above.
From my understanding in the links above you can do this on the amazon side.
Below are my current settings;
SqsMessageDrivenChannelAdapter adapter =
new SqsMessageDrivenChannelAdapter(queue);
adapter.setMessageDeletionPolicy(SqsMessageDeletionPolicy.ON_SUCCESS);
adapter.setMaxNumberOfMessages(1);
adapter.setSendTimeout(2000);
adapter.setVisibilityTimeout(200);
adapter.setWaitTimeOut(20);
Is it possible to extend this timeout?
Spring Cloud AWS supports this starting with Version 2.0. Injecting a Visiblity parameter in your SQS listener method does the trick:
#SqsListener(value = "my-sqs-queue")
void onMessageReceived(#Payload String payload, Visibility visibility) {
...
var extension = visibility.extend(20);
...
}
Note, that extend will work asynchronously and will return a Future. So if you want to be sure further down the processing, that the visibility of the message is really extended at the AWS side of things, either block on the Future using extension.get() or query the Future with extension.isDone()
OK. Looks like I see your point.
We can change visibility for particular message using API:
AmazonSQS.changeMessageVisibility(String queueUrl, String receiptHandle, Integer visibilityTimeout)
For this purpose in downstream flow you have to get access to (inject) AmazonSQS bean and extract special headers from the Message:
#Autowired
AmazonSQS amazonSqs;
#Autowired
ResourceIdResolver resourceIdResolver;
...
MessageHeaders headers = message.getHeaders();
DestinationResolver destinationResolver = new DynamicQueueUrlDestinationResolver(this.amazonSqs, this.resourceIdResolver);
String queueUrl = destinationResolver.resolveDestination(headers.get(AwsHeaders.QUEUE));
String receiptHandle = headers.get(AwsHeaders.RECEIPT_HANDLE);
amazonSqs.changeMessageVisibility(queueUrl, receiptHandle, YOUR_DESIRED_VISIBILITY_TIMEOUT);
But eh, I agree that we should provide something on the matter as out-of-the-box feature. That may be even something similar to QueueMessageAcknowledgment as a new header. Or even just one more changeMessageVisibility method to this one.
Please, raise a GH issue for Spring Cloud AWS project on the matter with link to this SO topic.

How to unit test asp.net api if using Application

In my globals.asax.cs, I am creating a dictionary object that I want to use in my APIs to add and get data from in the life of the application.
I do the following:
Application["MyDictionary"] = myDictionary;
In my ApiController I get a handle of it, in this way:
MyDictionary myDictionary= (MyDictionary)HttpContext.Current.Application["MyDictionary"];
So far so good, the issue is that I need to do the same in the unit test, I need to add this dictionary into my Application as well, so when I call my controller, I will be able to retrieve it, how do I do that ?
doing this:
HttpContext.Current.Application.Add("MyDictionary", myDictionary);
enter code here
doesn't work, I get an exception:
An exception of type 'System.NullReferenceException' occurred in RESTServices.Tests.dll but was not handled in user code
My HttpContext.Current is null.
Any ideas how to work around this ?
The HttpContext.Current is created when a request is received, so you need to set the Current property, before using it.
See the example below:
var myDictionary = new Dictionary<string, string>();
HttpContext.Current = new HttpContext(new HttpRequest("default.aspx", "http://localhost", string.Empty), new HttpResponse(new StringWriter(CultureInfo.InvariantCulture)));
HttpContext.Current.Application.Add("MyDictionary", myDictionary);

No signature of method: groovy.lang.MissingMethodException.makeKey()

I've installed titan-0.5.0-hadoop2 with hbase and elasticsearch support
I've loaded the graph with
g = TitanFactory.open('conf/titan-hbase-es.properties')
==>titangraph[hbase:[127.0.0.1]]
and a then I loaded the test application
GraphOfTheGodsFactory.load(g)
Now when I'm trying to create a new index key with:
g.makeKey('userId').dataType(String.class).indexed(Vertex.class).unique().make()
and I got this error:
No signature of method: groovy.lang.MissingMethodException.makeKey() is applicable for argument types: () values: []
Possible solutions: every(), any()
Display stack trace? [yN]
Can someone help me with this ?
when I want to see the indexed keys I see this
g.getIndexedKeys(Vertex.class)
==>reason
==>age
==>name
==>place
I'm not completely following what you are trying to do. It appears that you loaded Graph of the Gods to g and then you want to add userId as a new property to the schema. If that's right, then i think your syntax is wrong, given the Titan 0.5 API. The method for managing the schema is very different from previous versions. Changes to the schema are performed through the ManagementSystem interface which you can get an instance of through:
mgmt = g.getManagementSystem()
The syntax for adding a property then looks something like:
birthDate = mgmt.makePropertyKey('birthDate').dataType(Long.class).cardinality(Cardinality.SINGLE).make()
mgmt.commit()
Note that g.getIndexKeys(Class) is not the appropriate way to get schema information either. You should use the ManagementSystem for that too.
Please see the documentation here for more information.

Cast IPrincipal to IClaimsPrincipal returning null

I have inherited come code (an MVC web app) and am having trouble getting it to start.
These two lines exist:
var claimsPrincipal = principal as IClaimsPrincipal;
if (claimsPrincipal == null)
throw new ArgumentException("Cannot convert principal to IClaimsPrincipal.", "principal");
principal is an IPrincipal (in this case a System.Security.Principal.WindowsPrincipal), and is not null.
The first line sets claimsPrincipal to null, so the exception is thrown. I'm assuming it must have worked for someone at some point, and this is a fresh copy from source control. Why would this cast return null for me?
I see that this post is a long time ago. But I encountered the same problem today, and finally I get the way to resolve it.
In framework 4.5 or 4.6, you can directly cast System.Security.Principal.WindowsPrincipal into IClaimsPrincipal, because the first one implements the second one. But in framework 3.5 or 4.0, you cannot do this, becasue the first one doesn't implement the second one.It just implements IPrinciple, not IClaimsPrincipal. You can see it from MSDN link here.
Here it a way to resovle this and get the IClaimsPrincipal object.
var t = HttpContext.Current.User.Identity as WindowsIdentity;
WindowsClaimsPrincipal wcp = new WindowsClaimsPrincipal(t);
IClaimsPrincipal p = wcp as IClaimsPrincipal;
HttpContext.Current.User is a WindowsPrincipal, and finally you can get IClaimPrincipal.
principal might in fact be null. Did you debug that?
Check to see if the type of principal implements the IClaimsPrincipal interface.

Resources