In a desktop application I want to get the current user's email address to use Exchange Web Services auto discovery mechanism as here:
var svc = new ExchangeService()
{
UseDefaultCredentials = true
};
svc.AutodiscoverUrl("user#company.com");
I know the current users domain\username; how do I get the email address before configuring EWS?
You need to use something other then EWS to get that eg LDAP is generally the most common method eg see something like Get UPN or email for logged in user in a .NET web application
Cheers
Glen
Related
I have an app built with Node.js and running in Google Cloud. I need to sand certain system emails such as setting change confirmation, password reset tokens, etc. I use nodemailer and Google SMTP server for sending such mails. Till now I used a simple Gmail account like myaccount#gmail.com for this purpose. But now I want to send it from no-replay#mydomain.com.
My question is whether I need to create a new user in my Google Workspace (and pay monthly for it) for this purpose, or there is another way?
To use all the core services in Google Workspace you need to pay at least for the business standard edition $6 per month.
It's good if you're going to use it as a permanent or business solution. But if it's just for testing it's not worthy. It's better a trial.
As an alternative solution, if you have a cheaper SMTP server, you can add that email address as Send mail as in your free Gmail account and configure an alias in nodemailer
var mailOptions = {
to: user.email,
from: 'Domain Email <example#domain.com>',
subject: subject,
html: emailHTML
};
I have this working in js to give me the address of the logged-in Metamask user, but I would like to do it using Nethereum. Could someone tell me the equivalent to this with Nethereum?
var accounts = await web3.eth.getAccounts();
console.log(accounts)
This is impossible, because MetaMask is accessible only in the web frontend (JavaScript/TypeScript) and .NET does not run within a web browser.
To get the user address on the server side securely, you need to ask user to sign a message with MetaMask and then extract the address from the message signature.
for Nethereum right now we dont have any direct support that it can access Metamask , so in netherium you can only access account using private key or seed phrase
Like this below
var account = new Account(privateKey);
var publicAddressOfTheAboveAccount = account.Address;
Check the below link if you want to use metamask using Nethereum.Metamask.Blazor to access metamask account instance
checkthislink
I am using EWS managed API to implement notification subscription with exchange server. So, I am trying to figure out if I can assume that the autodiscovery url for users within the same domain will be same?
Yes
Autodiscover is used to get necessary information on how to connect to the exchange server by itself, with minimal user input required. It does so by taking the domain from the users e-mail address and is testing various standard EWS Exchange-Endpoints with it.
An example:
"https://" + domain + "/autodiscover/autodiscover" + fileExtension
Because users within the same domain communicate with the same exchange server, the AutodiscoverURL stays the same for all of them.
You should be using Autodiscover to work out the endpoint for ever user unless you have a very simple network topology (eg one server etc) so making that assumption woudn't be best practice. The URL that Autodiscover will return can be different for a number of reasons eg different Internal and External exchange configuration https://technet.microsoft.com/en-us/library/hh529912(v=exchg.150).aspx (so depending on the client location). Also if your using notifications on Exchange 2013 and up for multiple users then you should be using Autodiscover to get the grouping information for the users https://msdn.microsoft.com/en-us/library/office/dn458789(v=exchg.150).aspx so you can maintain affinity correctly.
I'm trying to port a conference app sample to WinRT at present.
In this app there are some feature where users can email specific people - e.g. on certain screens they can click buttons to send an email to the conference organisers, to one of the speakers, or to me - the app developer.
I've looked through the WinRT documents on MSDN and the only contract I can find which might be related to email is sharing - and this doesn't seem to allow you to specify who you are sharing too.
Is there some simple "send email to" method available in WinRT? e.g. something like EmailComposeTask in WP7?
Here's what I did:
Uri uri = new Uri("mailto:" + emailAddress, UriKind.Absolute);
await Launcher.LaunchUriAsync(uri);
It looks weird, but it works.
This allows you to set the email address and the subject, but not a full HTML body.
Using the share contract, you can set the subject and the body, but - indeed - not the address. This makes sense, as after all you don't know what app your content will be shared with. It may not be an email app at all, but e.g. a blog writer.
I have a client app written using EWS Managed API 1.1. Here's the situation:
The client does not run on a computer within the same domain as the Exchange Server.
I have the username and password of a user, but not their email address.
There's no commonality between username (e.g. ABC123\001234) and email address (e.g. joe.bloggs#company.com).
I can connect to EWS just fine, send messages, etc.
However my software needs to discover the authenticated user's email address, and for various requirements reasons can't just ask the user to provide it.
I assumed I'd be able to get such a simple detail back from the web service, but I'm stumped!
Is this possible for both 2007 and 2010?
Thanks!
You may be able to do it using ExchangeService.ResolveName. I tried it with the following EWS Managed API code example on Exchange 2007 and it worked like a charm:
var service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Url = new Uri("https://serv/EWS/exchange.asmx");
service.Credentials = new NetworkCredential("001234", "PasswordForUser001234", "Domain");
ServicePointManager.ServerCertificateValidationCallback = (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) =>
{
return true;
};
var resolvedNames = service.ResolveName("001234");
foreach (var resolvedName in resolvedNames)
{
Console.WriteLine(resolvedName.Mailbox.Address);
}