howto create issue comment in Gemini 5 API - gemini

I'm trying to add a comment to issue using Gemini 5 c# API.
The problem is that GeminiService.Item.IssueCommentCreate returns null.
commentDto object is created and passed to the IssueCommentCreate with the same properties filled (Comment, IssueId, Visibility) as for previous gemini api (FullName and ProjectId are not filled). I've tried to fill ProjectId but no luck.
Could you please share how are you adding comments?
Regards

The reason was that I've specified comment visibility that is not in the comment visibility classifier in the database.
For 15 visibility value null is returned by IssueCommentCreate but comments with visibility 1 and 12 are added without any problem
In the previous Gemini version (API Version 4.0.1.3038) I am able to add a comment with visibility 414 without any problem (comment object instance with ID filled is returned for it)
Regards

We used Gemini's sample API for ours and it works:
var comments = new IssueComment();
comments.Comment = txtComment.Text;
comments.ProjectId = projectId;
comments.UserId = userId;
comments.IssueId = issueId;
login.Item.IssueCommentCreate(comments);

Related

Change record owner in Dynamics CRM plugin

I am writing a Post PLugin changing the owner. When the owner has a substitution manager, the owner is changed to the substitution manager. I tried a service.Update and an AssignRequest, but these throw an exception.
When I post the request my entity cannot update (and then throws "The request channel time out while waiting for reply after 10:00:00"). But like I see there is no recursion, because when I logged it I have only one repetition of log and it has stopped before or on line with update.
var assignedIncident = new AssignRequest
{
Assignee = substManagerRef, //get it throw another method, alreay checked in test it`s correct
Target = new EntityReference ("incident", incedentId)
};
service.Execute(assignedIncident);
I tried to write target in another way
Target = postEntityImage.ToEntityReference()
I tried to write simple update but the problem is the same.
Entity incident = new Entity("incident" , incidentId);
incident["ownerid"] = substManagerRef:
service.Update(incident);
Can somebody help me with that? Or maybe show the way to solve it)
The plugin is triggering itself and gets in a loop. The system only allows a maximum of 8 calls deep within plugins and that is the reason it throws an error and rolls back the transaction.
To solve this issue redesign your plugin in the following way:
Register your plugin on the Update message of your entity in the PreValidation stage.
In the plugin pick up the Target property from the InputParameters collection.
This is an Entity type. Modify or set the ownerid attribute on this Entity object.
That is all. You do not need to do an update, your modification is now passed into the plugin pipeline.
Note: for EntityReference attributes this technique only works when your plugin is registered in the PreValidation stage. For other regular attributes it also works in the PreOperation stage.

Invalid Named Property

We call the microsoft exchange to set the extended property which in our case is an unique guid
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: An internal server error occurred. The operation failed., Invalid named property
Its been working great until now when some of our users are facing the above issue ....
val uId = getUniqueId();
val emailExtendedPropDef = new ExtendedPropertyDefinition(uId,"uniqueId", MapiPropertyType.String)
try {
email.setExtendedProperty(emailExtendedPropDef, uId.toString)
email.sendAndSaveCopy()
} catch {
case e: Exception =>
error(s"Exception in setting extended property for user $from", e)
throw e
}
trying to find the root cause of the issue, we are also thinking it might be related to throttling on Microsoft exchange for extended properties (Not sure how to prove if it's indeed throttling) any help to point us in the right direction will be of great help
Our use case is to able to retrieve the email when customer want's to reply back we want to retrieve that particular email to be included in users reply....currently we are using the uid to achieve that ....
we have been using the code as per the documentation here
https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/dd633654(v%3Dexchg.80)
and also the documentation here
https://github.com/OfficeDev/ews-java-api/wiki/Getting-Started-Guide#extended-properties
Update : As per the comments we do understand that we have to treat extendedProperty as a column definition and update the same column ...but we couldn't figure out how to achieve this as...Any code samples to point us in the right direction will be of great help
Latest Update : We have deleted some of the extendedPropertyDefinition's but still facing the same invalid property could some one please point us in the right direction
Is it safe to say that getUniqueId returns a different guid on each call? If so, then that is the problem. Think of the Guid for an extended prop as a namespace. The exchange store limits the number of custom extended props to something like 32k per mailbox. So you are likely hitting that limit. But aside from that, the main reason for creating an extended property is so that you can refer to it later. But if you are basically discarding the namespace each time, you are leaving orphaned props on items. Without understanding your particular scenario, I can only say that the Guid should be thought of truly as a namespace. Choose one for your app/company/scenario and hard code it. They create all the named props you want within that namespace. For instance, "MyProp/String" in Guid namespace 1 is a different property than "MyProp/String" in Guid namespace 2.

Adding DynamicPropertyInstance doesn't mark the SalesOrderDetail as valid

I have the following code:
var propertyInstance = new DynamicPropertyInstance()
{
DynamicPropertyId = new EntityReference(DynamicProperty.EntityLogicalName, Guid.Parse("0ceedfcc-68b2-e711-8168-e0071b658ea1")),
ValueString = jobId.ToString(),
RegardingObjectId = line.ToEntityReference(),
};
crmContext.AddObject(dynamicPropertyInstance);
crmContext.SaveChanges();
It is successfully adding a DynamicPropertyInstance to a SalesOrderLine, but when viewing the Order in the CRM UI it does not pass the validation (as it is a required property). I've not managed to find a way to make this property valid. Editing the property that I've added in the UI (resetting the value) also fails to mark the instance as valid. Adding exactly the same property through the UI does mark it as valid.
The Id of the DynamicProperty is correct, as verified by loading the 2 instance records through the SDK and comparing the properties. Rather strangely, when I load the 2 records through the SDK the one I've created in code has a validationstatus of true (even though it's not) and the one that I've created in the UI has a validationstatus of false and ValueString returns null (which is wrong). All of the other properties either match or have relevant values (such as dates, object Ids etc)
I'm probably missing a method call to recalculate whether the instance is valid or not, but I can't find anything in the documentation to support that. Failing that, it's possibly a bug in CRM
Raised a case with Microsoft support, and was given some workaround code:
//Get DynamicPropertyInstance
UpdateProductPropertiesRequest UpdateRequest = new UpdateProductPropertiesRequest();
UpdateRequest.PropertyInstanceList = new EntityCollection();
UpdateRequest.PropertyInstanceList.EntityName = DynamicPropertyInstance.EntityLogicalName;
Entity dpInstance = new Entity(DynamicPropertyInstance.EntityLogicalName, Dpi.Id);
dpInstance.Attributes.Add(nameof(Dpi.ValueString).ToLower(), "Blarg");
dpInstance.Attributes.Add(nameof(Dpi.DynamicPropertyInstanceid).ToLower(), Dpi.Id);
dpInstance.Attributes.Add(nameof(Dpi.RegardingObjectId).ToLower(), new EntityReference(SalesOrderDetail.EntityLogicalName, line.Id));
dpInstance.Attributes.Add(nameof(Dpi.DynamicPropertyId).ToLower(), new EntityReference(DynamicProperty.EntityLogicalName, dpId));
UpdateRequest.PropertyInstanceList.Entities.Add(dpInstance);
crmContext.Execute(UpdateRequest);
Basically, it looks like you have to re-set or re-attach the entities for CRM to pick it up, so this is a workaround for a bug in CRM

RetrieveMultipleRequest.MinActiveRowVersion what it this and when is it ever not -1

I have been investigating ways to synchronise incremental changes with dynamics crm.
I stumbled accross the MinActiveRowVersion property of RetrieveMultipleRequest
var orgService = serviceProvider.GetOrganisationService();
using (orgService as IDisposable)
{
var accounts = orgService.RetrieveMultiple(new QueryExpression("account") { ColumnSet = new ColumnSet("accountid") });
Console.WriteLine("min active is: " + accounts.MinActiveRowVersion);
}
This property always returns "-1" during my testing, even when I am trying to simulate transactions going on in the background, but its tricky to do.
My understanding of MinActiveRowVersion from a SQL perspective comes from here:-
[http://technet.microsoft.com/en-us/library/bb839514.aspx][1]
So my question is, is anyone able to clarify exactly what this MinActiveRowVersion property is, because I can't find anything useful in the SDK documentation!
To the best of my knowledge and experience it is never used and will always equal-1. Under the cover it is hard coded as a long and converted to a string when the EntityCollection object is built - so it will always be -1.
The SDK defines it as "the lowest active row version value" which implies it is related to SQL row versions, but CRM does not make use of this field. It is defined the same in the CRM 2011 and CRM 2013 SDKs.
In CRM 4 we had the BusinessEntityCollection, which was EntityCollection's predecessor. It had an unused string property called Version.
My guess, back when the CRM 2011 was being designed it got added for some potential functionality - which didn't survive - and never removed before it went RTM. Once it was released the product team didn't want to change the class definition and break existing code so they just left it there to live on returning -1.
MinActiveRowVersion is returned in the fetch response if the fetch query contained the attribute min-active-row-version=1. (In the same tag where page and distinct attributes are specified.)
We rely on this behavior for years. (And yes, we use it for synchronization of changes. Rowversion appears to be the only reliable tool. Note that not all Dynamics entities have Rowversion column. E.g. duplicaterule entity does not use it. For such entities we use modifiedon column.)
Here are some citations from $MS documentation:
##DBTS = The last-used timestamp value of the current database.
MIN_ACTIVE_ROWVERSION = The lowest active rowversion value in the
current database; ##DBTS + 1 if there are no active values in the
database.
A rowversion value is active if it is used in a transaction that has
not yet been committed.

How to set [$expand PageSize] for OData in ASP.NET WEB API?

I use the server-side page like this:
[Queryable(PageSize = 20)]
public IQueryable<T> Get()
{
return Repository<T>.GetAll();
}
then,I get items as GET http://domain.com/oData/EntityA?$expand=EntityB.
As I expected I got 10 "EntityA",but the navigation properties "EntityB" always only 10,too.
I google it,but nothing helped.
At $select and $expand support has some tip,but not solution:
PageSize for expanded feeds.
How can one specify page size for expanded feeds? WCF DS has a per entity-set configuration knob for page size. Should we follow their model?
So,how can I get all of EntityB though $expand,is need some config?
version:
Mvc 5.0.0-beta2
WebApi 5.0.0-beta2
WebApi.OData 5.0.0-rc1-130807
Data.OData 5.6.0-rc1
This feature is not implemented yet. We only have support for basic paging where the page size of the expanded feed is the same as the page size of the top feed. This is the issue on codeplex tracking it. Please vote for it to bump up its priority if it is important for you.

Resources