DynamicsCrm - Retrieve Multiple is not supported - c#

I´m developing a data-extraction tool that gets data out of DynamicsCrm.
I have a few tables tough where i get the following exception:
Additional information: The 'RetrieveMultiple' method does not support entities of type 'mailboxstatistics'.
Reading online, using fetchxml is supposed to be the solution.
For me, it looks like i´m already using fetchxml.
My code:
private static EntityCollection RequestEntityCollection(String FetchXML, Microsoft.Xrm.Client.CrmConnection c)
{
using (OrganizationService service = new OrganizationService(c))
{
EntityCollection r = service.RetrieveMultiple(new FetchExpression(FetchXML));
return r;
}
}
I´m currently using the CRM2013 SDK so EntityCollection is from the Microsoft.Xrm.Client.dll in v6.0.0.0.
Also the documentation is using the RetrieveMultiple method.
Do you have some suggestions or is this not supported and the online suggestions are misleading?
Thank you!

The message is a bit misleading.
You get that error with MailboxStatistics because the entity is for internal use only.

Related

Problem importing SLAs field data with Jira API

Good morning everyone! I am working on a c# API that interfaces with the Jira API via the Atalassian.Jira library. Specifically, to get the issues I am using IIssueService.
My problem now is that I have to import the sub-task SLA data and I have no idea how to do it. I noticed that in the imported issue object there is no data related to the SLAs.
I tried to google for answers but without success. Would anyone know how to help me?
Below is the code I use to import the issues (GetIssuesFromJqlAsync is a method of the library that I mentioned above)
{
var jql = $"issuetype = Sub-task And status = 'To Do'";
if (from.HasValue) jql = $"{jql} AND updated > '{from.Value:yyyy-MM-dd HH:mm}'";
return await jira.Issues.GetIssuesFromJqlAsync(jql);
}
Thank you for all the answers.

Cannot load model using WinML

As WinML is still fairly new and ever changing, I was hoping to know if anyone else has come across this error when trying to load a ONNX file made via the Custom Vision Service Export.
Type Error: Type (map(string,tensor(float))) of output arg (loss) of node (ZipMap) does not match expected type (seq(map(string,tensor(float))))
using Windows.AI.MachineLearning;
Windows RS5 1809 (build 17763.1)
UWP SDK 17763
Testing code from this link:
https://learn.microsoft.com/en-us/uwp/api/windows.ai.machinelearning
// Load and create the model
var modelFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///{_modelFileName}"));
_model = await LearningModel.LoadFromStorageFileAsync(modelFile);
Any help would be greatly appreciated.
Windows build 17763 (RS5) requires ONNX version 1.2 when Windows.AI.MachineLearning.
The Azure Custom Vision service supports this today .
Here is a post around a sample app that does this.
As a note, you need to make sure your output data type matches when you bind. In c# this looks something like this:
public sealed class ModelOutput
{
public TensorString ClassLabel = TensorString.Create(new long[] { 1, 1 });
public IList<IDictionary<string, float>> Loss = new List<IDictionary<string, float>>();
}
I received info from a Microsoft associate that stated that the windows.ai.machinelearning api only supports ONNX 2. He didn't supply a date to which we can expect the custom vision service to export version 2 files.

Unsupported Media Type error when using json-patch in Ramone

Update: I downloaded Ramone project, added it to my project and then ran the application again with debugger. The error is shown below:
public MediaTypeWriterRegistration GetWriter(Type t, MediaType mediaType)
{
...
CodecEntry entry = SelectWriters(t, mediaType).FirstOrDefault(); => this line throws error
...
}
Error occurs in CodecManager.cs. I am trying to figure out why it does not recognize json-patch media type. Could it be because writer is not being registered correctly? I am looking into it. If you figure out the problem, please let me know. Since you are the author of the library, it will be easier for you to figure out the issue. I will have to go through all the code files and methods to find the issue. Thanks!
I was excited to know that Ramone library supports json-patch operations but when I tried it, I got following error:
415- Unsupported Media Type
This is the same error that I get when I use RestSharp. I thought may be RestSharp does not support json-patch and errors out so I decided to try Ramone lib but I still get same error. Endpoint has no issues because when I try same command using Postman, it works but when I try it programmatically in C#, it throws unsupported media type error. Here is my code:
var authenticator = new TokenProvider("gfdsfdsfdsafdsafsadfsdrj5o97jgvegh", "sadfdsafdsafdsfgfdhgfhehrerhgJ");
JsonPatchDocument patch = new JsonPatchDocument<MetaData>();
patch.Add("/Resident2", "Boyle");
//patch.Replace("/Resident", "Boyle");
RSession = RamoneConfiguration.NewSession(new Uri("https://api.box.com"));
RSession.DefaultRequestMediaType = MediaType.ApplicationJson;
RSession.DefaultResponseMediaType = MediaType.ApplicationJson;
Ramone.Request ramonerequest = RSession.Bind("/2.0/files/323433290812/metadata");
ramonerequest.Header("Authorization", "Bearer " + authenticator.GetAccessToken(code).AccessToken);
//var ramoneresponse = ramonerequest.Patch(patch); //results in error: 405 - Method Not Allowed
var ramoneresponse = ramonerequest.Put(patch); //results in error: 415 - Unsupported Media Type
var responsebody = ramoneresponse.Body
Endpoint information is available here: http://developers.box.com/metadata-api
I used json-patch section in the following article as a reference:
http://elfisk.dk/Ramone/Documentation/Ramone.pdf
By the way I tried Patch() method (as shown in above ref. article) but that resulted in "Method not allowed" so I used Put() method which seems to work but then errors out because of json-patch operation.
Any help, guidance, tips in resolving this problem will be highly appreciated. Thanks much in advance.
-Sham
The Box documentation says you should use PUT (which is quite a bit funny). The server even tells you that it doesn't support the HTTP PATCH method (405 Method Not Allowed) - so PUT it must be.
Now, you tell Ramone to use JSON all the time (RSession.DefaultRequestMediaType = MediaType.ApplicationJson), so you end up PUT'ing a JSON document to Box - where you should be PUT'ing a JSON-Patch document.
Drop the "RSession.DefaultRequestMediaType = MediaType.ApplicationJson" statement and send the patch document as JSON-Patch with the use of: ramonerequest.ContentType("application/json-patch+json").Put(...).

How do you actually implement the Search Contract? (C#)

I'm having some trouble understanding and getting the search contract to work in my Store app. I have been unable to find any sort of documentation or guide that explains the structure of using the contract. (I've looked at the quickstarts on MSDN, the Search Contract sample and the build video, but that only really deals with javascript)
So far I've been able to run a query and get a list (of Custom Objects) into my search contract page, and from there I try to assign that to defaultviewmodel.results, but no matter what query I type nothing shows up I on the page. Is there something else I need to set?
What I have so far is as follows (excerpts):
App.xaml.cs
protected override void OnSearchActivated(Windows.ApplicationModel.Activation.SearchActivatedEventArgs args)
{
SearchCharmResultsPage.Activate(args.QueryText, args.PreviousExecutionState);
SearchCharmResultsPage.ProcessSearchQuery(args.QueryText);
}
public async static void ProcessSearchQuery(string queryString)
{
try
{
StorageFile file = await ApplicationData.Current.LocalFolder.GetFileAsync("recipeCustomObject Debug.WriteLine("Database exists, connecting");
SQLiteAsyncConnection connection = new SQLiteAsyncConnection("CustomObject_db");
List<CustomObject> resultsList = new List<CustomObject>();
string query = "SELECT * FROM CustomObjectDB";
resultsList = await connection.QueryAsync<RecipeRecord>(query);
}
catch (FileNotFoundException fnfExc)
{
Debug.WriteLine("FNFEXC: " + fnfExc.ToString());
}
}
I think it is possible that here lies the problem, though I'm not sure if it is, or how to change it.
the resultsList list is created here, but because the method it asynchronous, I can't return from the method. Because of this I'm guess that when I try to assign this.DefaultViewModel[Results] = resultsList; in the LoadStateMethod, the object doesn't exist (thought the program throws no error). When I try to add the same line in the ProcessSearchQuery method, i'm told that this is not valid in a static method, but I think I need the method to be static? My problem might just be a fundamental logic error?
Finally got it! found the solution here: http://jeffblankenburg.com/2012/11/06/31-days-of-windows-8-day-6-search-contract
For those looking for an answer in the future, the key is to make sure you have your search logic within the Filter_SelectionChanged method, which was something I wasn't doing. Look at the guide within the above link to get an idea of the structure.
Have you looked at the Search contract sample on the developer center? There's a C#/XAML version there as well.
My open source Win8 RSS Reader framework implements Search (and Share) have a look at the source and if you still got questions, I'll be happy to help http://win8rssreader.codeplex.com/

Telerik OpenAccess ORM with SQL Server 2005

I'm trying out this ORM & new to this. I have following code:
IObjectScope scope = Database.Get("MyConnection").GetObjectScope();
try
{
scope.Transaction.Begin();
Reading r = new Reading();
r.ReadingURL = reading.ReadingURL;
r.IsActive = true;
scope.Add(r);
scope.Transaction.Commit();
}
finally
{
scope.Dispose();
}
When I run this I get following error on "Add":
Telerik.OpenAccess.Exceptions.InvalidOperationException: Class
'WritingChallenge.Reading' is persistent but not known in this
context.
It seems for some reason database connection is lost? I'm not sure what is the issue here.
The issue here is that the model that was connected to the WritingReplacementConnection was having no information about the WritingChallenge.Reading type.
Did you specify a mappingConfiguration that included this type?
You can also ask this kind of questions in the forums at Telerik Forums - .NET ORM.

Categories

Resources