I am trying to write an mailsender in C# for sharepoint but each time I start it I get this error message that tells me that it doesn't have permission.
I tried do give it permission at AppManifest.xml but I don't know which... I tried all but nothing seams to help.
my code:
private void SendEmail( ClientContext clientContext )
{
User sendToUser = clientContext.Web.EnsureUser( "mymail@mail.com" );
clientContext.Load( sendToUser );
clientContext.ExecuteQuery();
string email = Microsoft.SharePoint.Client.Utilities.Utility.GetCurrentUserEmailAddresses( clientContext ).Value;
Microsoft.SharePoint.Client.Utilities.EmailProperties properties = new Microsoft.SharePoint.Client.Utilities.EmailProperties();
properties.To = new string[] { sendToUser.Email };
properties.Subject = "subject";
properties.Body = "body";
Microsoft.SharePoint.Client.Utilities.Utility.SendEmail( clientContext, properties );
clientContext.ExecuteQuery();
}
Dos someone have a tip for me what could be wrong.