Get current logged in user using Exchange SOAP web services - soap

we are using Exchange 2010 SP1 SOAP web services. I can't find the API to get the current (authenticated) user's information.

If you want to get the current user’s own email:
You could use ConvertId with a generic address and Exchange will then return the PrimarySMTP for that mailbox eg:
Folder Inbox = Folder.Bind(service, WellKnownFolderName.Inbox);
AlternateId aiAlternateid = new AlternateId(IdFormat.EwsId, Inbox.Id.UniqueId, "mailbox#domain.com");
AlternateIdBase aiResponse = service.ConvertId(aiAlternateid, IdFormat.EwsId);
Console.WriteLine(((AlternateId)aiResponse).Mailbox);
AutoDiscover will also return the PrimarySMTP address of a Mailbox is you do a POX based discovery.
To check other addresses you can also use ResolveName:
Resolve ambiguous names by using EWS in Exchange 2013
If you want to get the displayname of the logged in user in EWS:
If you are going to use ResolveName and you want the displayName then you should use the overload to specify that the operation should return the AD contact information. Then you can just use the DisplayName property.
NameResolutionCollection ncCol = service.ResolveName("user#domain.com",ResolveNameSearchLocation.DirectoryOnly,true);
Console.WriteLine(ncCol[0].Contact.DisplayName);
For more information, you could refer these link:
How do I get the displayname of the logged in user in EWS?
How get the current user's own email address or check entered, using Exchange Web Services?

Related

How to retrieve the remote Ip address for a Contact Form 7 submission?

I am using Contact Form 7 to collect data and send it through the CF7 to API Plugin.
For security reasons, I receive the data via email through the [wpcf7.remote_ip] tag, which I insert in the email field as per the guide.
Screen of The Email Body:
But when I try to send the same data via API through "CF7 to API", the value is empty.
Screen of the CF7 to API setup:
Where am I wrong?
Screen of the CF7 to API log:
wpcf7.remote_ip is only valid in an email template because it is created/populated by the CF7 plugin when the notification mail is being processed. You will need to create your own hidden field on the form when the page is loaded which you can then use in your API listing,
add_filter('wpcf7_form_hidden_fields','add_hidden_ip_field');
function add_hidden_ip_field($fields){
$fields['remote_ip'] = ... //get the remote IP
return $fields;
}
NOTE: to get the request remote IP, see this answer
You can then use the field remote_ip in your API

NetSuite REST Services - Company Address

I am working on external application to pull data from NetSuite using NetSuite's REST services.
Unable to find the way to pull Company Address.
Please respond if you the way.
The Company's address would be present in NetSuite's Company Information section (i.e navigate to Setup --> Company --> Company Information).
If you are using a NetSuite Restlet script to pull Company address, you need to use "N/config" module.
So using the N/config module, load the company information record:
var companyInfo = config.load({
type: config.Type.COMPANY_INFORMATION
});
// then get value of Company address
var companyAddress = companyInfo.getValue({
fieldId: 'mainaddress_text'
});
return companyAddress; // return the address in Restlet script
Hope this helps.

Change the displayname of the sender when sending mail via o365?

Is it possible to control the display name of the sender when sending mails with the office 365 OutlookServicesClient?
I.e., I want to use, say mailer#domain.com as the sender which is configured with the name some name#domain.com in office 365. But for a given mail I want the from name to instead be some other name#domain.com.
I've tried this:
Message draftMessage = new Message
{
Subject = subject,
Body = body,
ToRecipients = toRecip,
CcRecipients = ccRecip,
From = new Recipient()
{
EmailAddress = new EmailAddress() { Address = "mailer#domain.com", Name = "Some other name#domain.com" }
}
};
But the mail is still sent with the preconfigured name of some name#domain.com.
So, is what I want possible?
According to the reference documentation for the Message object, what you want to do is possible. However, logic tells me that shouldn't be possible, and furthermore, the testing I did showed me it wasn't possible (or isn't working). I will follow up on this and update this answer when I get a definitive answer, but at this time, it appears like you can't change the name of the sender (or it's broken).
UPDATE: The From property is writable. I've tested this using pure REST, so I can't speak exactly to what the client library you are using is doing, but I think the request is being transformed to prevent spoofing.
It is possible to control the display name of the sender, but you can only do so with other users in your Office 365 tenant. To do this, sign in to the Office 365 Admin Portal, go to Users, then Active Users, then select the user (User A) that you want to send on behalf of. Click Edit and select Mailbox Permissions. Add the alias or email address of the user (User B) who is running the code (the user authenticated with your app) to the first box under Send email from this mailbox. This will allow you to set the From property of a message sent by User B as User A.
I understand this isn't exactly what you were after, but having the ability to send email as any email address can lead to some bad stuff. Hope this helped!

Configurating JOOMLA's e-mail notification for new account

I'm using Joomla 1.5 to create a local site for my office. The site will be accessed locally via intranet, and my PC will be the localhost for the site.
I'm using a Login pluggin, so that anyone who wanted to enter the site should create an account.
In JOOMLA, all user who created their account for the first time will receive a notification e-mail like :
"Hello pras,
You have been added as a User to Information Center by an
Administrator.
This e-mail contains your username and password to log in to
http://localhost/yaddayadda/
Username: hadisuryo.prasetio Password: xxxx
Please do not respond to this message as it is automatically generated
and is for information purposes only."
but if the user click the URL in the mail, which is, "localhost/yaddayadda/" they will not be directed to my site, but to their own PC's localhost....
My question is : How can I Modified the e-mail or the site configuration so that the URL will not be "localhost/yaddayadda/" anymore, but will be "(My-IP address)/yaddayadda"
I'm not going to host my site to a web hosting service, just using my PC as a host.
I've been trying to trace on each config and .ini files...it seems that i have to do something with the "JURI" function or the "$mosConfig_live_site" on the backlink.php file
$mosConfig_absolute_path = JPATH_SITE;
$mosConfig_live_site = JURI :: base();
$url_array = explode('/', $_SERVER['REQUEST_URI']);
Can anyone give me assistance ?
actually what the joomla does it takes the value as $_SERVER for the host so what you have to do u just append "/yaddayadda" at the email template of the joomla
You could edit:
%SITE_ROOT%/administrator/language/en-GB.com_users.ini at around LINE 28, which reads
NEW_USER_MESSAGE=Hello %s,\n\n\nYou have been added as a User to %s by an Administrator.\n\nThis e-mail contains your username and password to log in to %s\n\nUsername: %s\nPassword: %s\n\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only.
Be careful with the '%s' variable as it appears to insert different values in each instance. First instance renders their NAME, second SITE NAME, third one is the USER NAME, etc, etc.
-Dennis
You can find those values in root/components/com_users/models/registration.php on line 88. It appears it pulls it out of the array that is being created their.

How to check SharePoint document permissions?

I have a custom web service deployed in SharePoint, web method of this webservice expects a SharePoint docuentUri as a parameter. As it is deployed in the SharePoint environment i am done with SharePoint authentication, but the question here is that how do i check whether the user reqesting for a perticular document is authroized or not ? In other words web service method should return some unauthorized exception if the user does not have privilege to view the document ? All i have is the SharePoint documentUri to pass as an inpurt parameter.
thanks.
Assuming your web service is deployed in the context of SharePoint in the /_vti_bin virtual directory of your SharePoint site, you can use the SharePoint object model like below to check if the calling user has specific privileges to your document. Unfortunately, the CheckPermissions call will throw an UnauthorizedException if the check fails, so it would have to be caught.
string uri = "http://localhost/Shared%20Documents/Document1.doc"; //full path to doc
using (Microsoft.SharePoint.SPSite site = new Microsoft.SharePoint.SPSite(uri))
using (Microsoft.SharePoint.SPWeb web = site.OpenWeb())
{
Microsoft.SharePoint.SPListItem item = web.GetListItem(uri);
item.CheckPermissions(Microsoft.SharePoint.SPBasePermissions.OpenItems);
}
Hope this helps,
Steve