When I trying to write some HTML text to Note, I have error (I think because HTML have some prohibited tags):
Evernote.EDAM.Error.EDAMUserException
When I use the same HTML with:
ENNote.Content = ENNoteContentAdvanced.NoteContentWithSanitizedHTML(HTML);
it works fine.
But I need get notes by ID, for updating. And I am not understand how I can write correctly HTML to Note (in HTML I have tables), or catching ENNote by GUID.
UPD.
I writing service for synchronization Notes (EN) between Evernotes and Microsoft Exchange Appointments (MA). When user create/update EN, my service create/update MA. When user update MA (created from Evernote), my service update EN. For linking I use EN GUID (I store it in MA in extended property). So I can find EN with this code:
List<ExtendedProperty> guids = appointment.ExtendedProperties.Where(ap => ap.PropertyDefinition == guidProp).ToList();
if (guids.Count > 0)
{
string guid = (string)guids.First().Value;
Note sNote = store.GetNote(guid, true, false, false, false);
}
But when I trying to set EN content I have error:
Error code "ENML_VALIDATION"
Parameter = "Document is invalid: no grammar found"
I can't store ENNoteRef in MA, because it object, not string. So I need to find ENNote by GUID (not ENNoteRef), or some stuff to set HTML to Note.Content without loosing tables.
It would help if you provide more of your code that surrounds the ENNote.Content call so we have more context.
Given the code you've provided: once you've created the ENNote and its content using the NoteContentWithSanitizedHTML function, you're then adding the note to the Evernote service with something like the following, correct?
ENNoteRef myNoteRef = ENSession.SharedSession.UploadNote(ENNote, null);
When you do this, you get back a NoteRef object, which is a reference to an actual specific note in the Evernote service. The NoteRef object has a Guid property, which is what you're looking for.
Related
I have a custom attribute with the type 'file' and I need to delete the file via a plugin.
I checked the documentation located here: https://learn.microsoft.com/en-us/powerapps/developer/data-platform/file-attributes and it says that for .net I have to use DeleteFileRequest.
I checked the documentation for this request and looks like it requires file ID, but I'm not sure where I can get it.
I tried to pass parameters in the ParameterCollection, similar to the Download Request, but it doesn't work this way:
var req = new DeleteFileRequest()
{
Parameters = new ParameterCollection()
{
new KeyValuePair<string, object>("Target", new EntityReference("xxx_entityName", locId)),
new KeyValuePair<string, object>("FileAttributeName", "xxx_attributeName")
}
};
Didn't find any samples for this request in Google, so if someone has any experience with this - please share.
Thank you.
You can get simply get File GUID from simple Retrieve or RetrieveMultiple message request in the CRM Organization Service object and after retrieving it, you can simply make the following deleteFileRequest:
DeleteFileRequest deleteFileRequest = new DeleteFileRequest()
{
FileId = new Guid(entityResult.Entities[0].Attributes["FieldLogicalName"].ToString())
};
DeleteFileResponse deleteFileResponse = (DeleteFileResponse)organizationService.Execute(deleteFileRequest);
This Thread is quite old, but the answers were not that exact:
First of all, if you look at the entity containing the file field with oData, you will find that the file field contains a Guid (and there is a second _name field with the file name). However at least spkl wont generate an earlybound for the file field.
So the first discovery is: You need to access the field LateBound and the containing Data Type is Guid! This code will work : myEntity.GetAttributeValue<Guid>("<filefieldname>");
And now Waleeds code will work, I've wrapped it in an Extension function to not clutter my logic:
public static void DeleteFile(this Entity entity, string fieldName, IOrganizationService service)
{
if (!entity.Contains(fieldName))
return;
var fileId = entity.GetAttributeValue<Guid>(fieldName);
if (fileId == Guid.Empty)
return;
DeleteFileRequest deleteFileRequest = new DeleteFileRequest()
{
FileId = fileId
};
service.Execute(deleteFileRequest);
}
And finally call it after my Code has finished parsing the file:
var fileIdEntity = Service.Retrieve(target.LogicalName, target.Id, new Microsoft.Xrm.Sdk.Query.ColumnSet(fieldname)).GetAttributeValue<Guid>(fieldname);
//Downloading and Parsing here
fileIdEntity.DeleteFile(fieldname, Service);
By the way: Upload and Delete both trigger Plugins registered on the file field as the Guid in the file field changes.
I was able to get the File ID (GUID) that is required for the DeleteFileRequest. It presents in the target Entity in file attribute during file upload. So in the plug-in registered at ModifiedOn (can't use File field as a trigger), you can see in the file field the ID. You can save it somewhere for later use.
Unfortunately still not sure how to get it for the already uploaded file. Please share your thoughts if you know how to do it.
I am using the Microsoft Graph API to access some events in my company's Azure AD Outlook.
The problem I am now having is that I can not access the CalendarView (or really I can't access the user at all) when I try to specify the user with an UUID instead of an email. The strange thing is that email works just fine, but I am not allowed to store emails outside of the Azure AD, so ID would be the preferred method.
Here is the exact API call I try to make: https://learn.microsoft.com/en-us/graph/api/user-list-calendarview?view=graph-rest-1.0&tabs=csharp
But all examples only use the .Me accessor and not the .Users[{ID | userPrincipalName}]
I am quite sure that the UUID I use is correct since it comes from an API call earlier. Or does the documentation article mean something else than the user UUID by {ID | userPrincipalName}?
A room looks like this (when read as a JSON object):
{
"id": "00000000-0000-0000-0000-000000000000"
"emailAdress": "room#company"
...
}
This works:
await graphClient.Users["room#company"].CalendarView.Request(queryOptions).GetAsync();
While this does not work:
await graphClient.Users["00000000-0000-0000-0000-000000000000"].CalendarView.Request(queryOptions).GetAsync();
When using the UUID I get (IDs not shown here):
Code: ErrorInvalidUser
Message: The requested user '<UUID>' is invalid
ClientRequestId: <some ID>
I did test this with a hardcoded room id and email but also with the ID object I get from calling the roomlist in C#.
Another inconsistency I encountered is that I can read the whole list of microsoft.graph.room via a http request but not using the C# Microsoft.Graph.Auth package. Reading the data of a room I know the email from does however work.
So does this just not work and the doc doesn't say so?
Does the Microsoft.Graph.Auth package not support those kind of requests?
Or do I use a wrong ID?
Saladino
According to some test, only when I use incorrect object id of user it shows same error message as yours.
If I use another user's object id(not object id of the user do authentication), it will show ErrorAccessDenied because do not have permission.
If I use the object id which the user not exist in Azure AD(incorrect object id), it will show same error message with yours. So please check if the uuid which you mentioned is the user's object id(shown in below screenshot) in your Azure AD and please check if you input the correct format of object id in your code by Console.WriteLine(object id)
I'm connecting to a WSDL through visual studio to build a web request in c#, but having an issue with authentication. The company we're working with requires information to be in the header, but doesn't expose the information they need through the WSDL, saying that, "this exact header needs to be included in all requests".
Theoretically I'd like to just get the header built in a StringBuilder object and attached to the client object, but I can't see how to do that easily. Everything I use, like WCFExtras+ or even just System.ServiceModel.Channels.MessageHeader wants an object, values, and a ns (which is obvious with C# being an OOPL).
I tried doing something like this, but i realized you can't just add XML manually like this, it strips out < and > into web-safe text equivalents:
using (var client = new productsClient())
{
using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
{
MessageHeader<string> header = new MessageHeader<string>("wsse:Security", true, "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", true);
var untyped = header.GetUntypedHeader(hardcodedHeader, "http://api.xxxcon.com/xxx");
OperationContext.Current.OutgoingMessageHeaders.Add(untyped);
var request = new productRequest();
response = client.getProduct(request);
}
}
Perhaps using the MessageHeader.CreateHeader is the answer? I can use this to create a simple header that has one line
(in the shape of value) but when i try to nest the requests together to create a parent and child relationship:
var username = System.ServiceModel.Channels.MessageHeader.CreateHeader
("wsse:UsernameToken ", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
, usernameString);
var pw = System.ServiceModel.Channels.MessageHeader.CreateHeader
("wsse:Password", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
, passwordString);
var header1 = System.ServiceModel.Channels.MessageHeader.CreateHeader
("wsse:UsernameToken ", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
, "", username);
But again, this throws an error. I suspect this class wasn't meant to nest xml objects like this.
All in all, I'd like to actually use the WSDL and not have to manually generate all the XML, but it seems i'm hindered by object-orientation, when i really want to just say, "here's the header, just trust me that everything is there. slap this baby right on".
Is anybody familiar with what to do in this circumstance? Thank you in advance.
I have a solution with 2 projects:
Contains the API
the module where i can select data (combobox etc...)
in the second module i select the API as reference that way i should be able to use data from the first module (my API) using Mollie.Api;
The First thing i want to do is fill a combobow with all the issuers, they should be in issuers.data:
Issuers issuers = mollieClient.GetIssuers();
foreach (Issuer issuer in issuers.data)
{
comboBox1.Items.Add(issuer.name);
}
the problem i have is: mollieClient does not exist in current context
i want to fill another combobox with methods but when i try to do it how they say i should do it doesnt work:
Method methods = new Method();
methods = Mollie.Api.Method.all();
however when i do:
Mollie.Api.Method.* the helper gives me then all the possible methods at *, but how can i get them automaticly in my combobox?
The second thing is when the method and issuer is selected i want to send that data back to the API. The API should be able to proces this and send me a message back that the transaction was a succes.
It appears like you're using mollie-api-csharp. You've written mollieClient, but according to the source Mollie.Api.MollieClient should start with a capital letter.
EDIT: Looks like you're following the how-to-use tutorial from the repo.
I think you forgot to create the MollieClient instance before getting the issuers.
MollieClient mollieClient = new MollieClient();
mollieClient.setApiKey("your_api_key_here");
I am using Google API to test below code:
MailItemService mailItemService = new MailItemService(domain, "Sample Migration Application");
mailItemService.setUserCredentials(userEmail, password);
MailItemEntry entry = new MailItemEntry();
entry.Rfc822Msg = new Rfc822MsgElement(rfcTextOfMessage);
Referring to this Link .
I used Sample Value given for "rfcTextOfMessage".
But how to change To,Send and Date values for different mails?
Is there any way to get this format?
Note: I am using C#
In this example rfcTextOfMessage should be a string containing the actual email. If you're migrating messages this would simply be a string containing the entire raw message (headers, body, and encoded attachments) you want to load into google. The format of the message is rfc822; if you want to create a new message from scratch, or modify an existing one, simply edit the string (I'm not aware of any .Net classes which will output an rfc822 formatted string to make editing easier). If you're going to modify dates there's a tip here about doing that.