I have UI where I have the user enter the Url where I can find the Exchange Web Service(EWS). My application uses EWS to get Free/Busy information but my configuration tool just needs to set it for the user.
For now I am just asking for the host name and building up the Url from there. For example they enter example.org as the host and I build https://example.org/EWS/Exchange.asmx from that.
I would like to add a test button to ensure the host they entered is reachable by the machine they are configuring. But I'm not sure how simple or complex I need to be to test the service.
Is there any noop or bind I can do to make sure I can establish communication with EWS?
Something like:
var serviceUri = new Uri(_textBoxEwsUrl.Text));
var exchangeService = new ExchangeService();
exchangeService.Url = serviceUri;
// what can I call here to test that I can talk to the exchangeService?
exchangeService.????
Bind to the inbox folder of the users mail address. Of course, you would need his credentials to this.
Any kind of operation that results in communication with server can be used as test. Simple binding to any folder or item will throw ServiceRequestException or some different type of exception if your url or credentials are incorrect.
Sample code:
try
{
var inbox = Folder.Bind(service, WellKnownFolderName.Inbox);
}
catch(ServiceRequestException e)
{
//handle exception in some way
}
Related
I've using a custom GetMailTips SOAP call (since the EWS for Core 2.0 doesn't support it) to get Out of Office info for a batch of email addresses.
How can I get the display names of the users that I am passing in the email address for?
I can call ResolveName of the managed API and that works but it has to be done one at a time and that is slow. I would like to ideally get this info out when I make my GetMailTips request and failing that make a call with all the email addresses to get the Display Names all at once. I read there is meant to be a ResolveNames method but that's not in the API either.
Any help appreciated
Autodiscover can return that for multiple users eg
AutodiscoverService adService = new AutodiscoverService(ExchangeVersion.Exchange2013_SP1);
adService.Credentials = new NetworkCredential("user#d.com", "pass");
adService.RedirectionUrlValidationCallback = adAutoDiscoCallBack;
List<String> Users = new List<string>();
Users.Add("user1#domain.com");
Users.Add("user2#domain.com");
GetUserSettingsResponseCollection usrSettings = adService.GetUsersSettings(Users, UserSettingName.UserDisplayName);
foreach(GetUserSettingsResponse usr in usrSettings)
{
Console.WriteLine(usr.Settings[UserSettingName.UserDisplayName]);
}
Another way would be to create a Message and add the email address as recipients then save it to the drafts folders and the address should get resolved against the GAL.
I have a running Realm Object Server on my Mac (192.168.100.61:9080 ip), and Xamarin App on PC.
I want to save/synchronize data on the ROS.
How I can to connect to ROS from code?
You need to login/register a user and open a synchronized Realm. Something like:
// pass createUser: true to register rather than login
var credentials = Credentials.UsernamePassword("foo#bar.com", "super-secure", createUser: false);
// Login the user
var user = await User.LoginAsync(credentials, new Uri("http://192.168.100.61:9080"));
// Create a sync configuration for the Realm
// Notice the URL uses the realm scheme and not http
var config = new SyncConfiguration(user, new Uri("realm://192.168.100.61:9080/~/myrealm"));
// Finally, get the Realm instance
// This Realm will be kept in sync with the remote one
var realm = Realm.GetInstance(config);
For more details, check out the documentation.
I am trying to get the service from a website ,so i connect to the webService like this :
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress(domainAddress+"/services/reportSRC.svc");
ChannelFactory<IReportSRC> factory = new ChannelFactory<IReportSRC>(binding, address);
IReportSRC channel = factory.CreateChannel();
So but sometimes the service is not available .how can i check this ability ?i mean if the service is available i connect to it otherwise show the error the service is not available
Suppose i have a list that contains several services and a state ,if the service is available the state is true otherwise is false.
you can always use a try-catch block and call the method for testing purpose of your choice.
try
{
serviceClient.AnyMethod();
}
catch
{
//Service not available
}
I am analyzing a users Exchange mailbox with calls to the ExchangeService. This tool needs to run on the client environment periodically and by ommiting the credentials to the service I am connecting to the Exchange Service as the logged in Windows User. I can succesfully loop thrue the folders and items.
Now I want tot retrieve the information about the mailbox being used. Username and (main) E-mail should suffice. But I cannot find anything about how to retrieve this information. Every example provides credentails for the user, or auto-discovering the Exchange service from the e-mail adres. I do not want the user to configure anything :-).
Any suggestions?
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Url = new Uri("https://FQDN/EWS/Exchange.asmx");
???
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.SentItems, new ItemView(100)); // this works
I've tried using service.ResolveName, but that can give multiple answers, even using Environment.UserName
The easiest method to do this is to use ConvertId operation and use unresolvable address (blah#blah.com always works for me) in the Mailbox element. Exchange should convert this to the actual Mailbox in the response. eg
Folder chk = Folder.Bind(service, WellKnownFolderName.Inbox);
AlternateId aiItem = new AlternateId();
aiItem.Mailbox = "Blah#Blah.com";
aiItem.UniqueId = chk.Id.UniqueId;
aiItem.Format = IdFormat.EwsId;
String CasServer = service.Url.Host.ToString();
AlternateIdBase caid = service.ConvertId(aiItem, IdFormat.HexEntryId);
Console.WriteLine(((AlternateId)caid).Mailbox);
Cheers
Glen
I want to connect hadoop in c# using HDInsight. I have created a cluster in AZURE and it was created successfully. and also I enabled remote desktop connection in it.
When I entered the credentials in C# and execute the job then I get the connection error. I am confused in providing the parameters. Kindly assist me.
var hadoop = Hadoop.Connect(new Uri("https://clustername.azurehdinsight.net"), "admin", "");
//I have set remote desktop password
var config = new HadoopJobConfiguration();
config.InputPath = "input/CodeFiles";
config.OutputFolder = "output/CodeFiles";
var result = hadoop.MapReduceJob.ExecuteJob<NamespaceCounterJob>();
Last line gives the exception.
Exception message is:
One or more errors occured
And this is the inner exception:
Unable to connect to the remote server
The Uri should be your Cluster Name, not Username, like:
var hadoop = Hadoop.Connect(new Uri("https://clustername.azurehdinsight.net"), "username", "password");
var config = new HadoopJobConfiguration();
config.InputPath = "input/CodeFiles";
config.OutputFolder = "output/CodeFiles";
var result = hadoop.MapReduceJob.ExecuteJob<NamespaceCounterJob>();
The cluster name is shown at the top of the detail page in the Azure portal for your cluster. Also, you don't need to enable RDP to use this method, it's actually the username set for "Hadoop Services" in the configuration tab of the cluster. Launching a job in this manner makes use of the WebHCat/Templeton endpoint, so RDP is not required.