2015-10-17 57 views
2

这似乎不可能找到,除非也许没有一个它。但是,任何人都知道(如果有的话)用于打开Microsoft Outlook Mobile App的iOS URL方案直接到预定义的TO_EMAIL,SUBJECT和BODY的撰写屏幕?iOS的URL计划微软Outlook应用程序

回答

6

这是我发现的一个链接,帮助我与IOS Outlook URL Scheme

,从我能想出这个代码:

// Create an array of recipients for the email. 
NSArray* emailRecipients = @[@"[email protected]", @"[email protected]"]; 

// Create a mutable string to hold all of the recipient email addresses and add the first one. 
NSMutableString* emailTo = [[NSMutableString alloc] initWithString:emailRecipients[0]]; 
// Loop through all of the email recipients except for the first one. 
for (int index = 1; index < emailRecipients.count; index++) 
{ 
    // Add a semicolon and then the email address at the current index. 
    [emailTo appendFormat:@";%@", emailRecipients[index]]; 
} 

// Get the email subject from the subject text field. 
NSString* emailSubject = fieldSubject.text; 
// Encode the string for URL. 
NSString* encodedSubject = [emailSubject stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]]; 
// Get the email body from the body text field. 
NSString* emailBody = fieldBody.text; 
// Encode the string for URL. 
NSString* encodedBody = [emailBody stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]]; 

// See if the subject or body are empty. 
if (![emailSubject length] || ![emailBody length]) 
{ 
    // Exit. 
    return; 
} 

// Create a string with the URL scheme and email properties. 
NSString *stringURL = [NSString stringWithFormat:@"ms-outlook://compose?to=%@&subject=%@&body=%@", emailTo, encodedSubject, encodedBody]; 
// Convert the string to a URL. 
NSURL *url = [NSURL URLWithString:stringURL]; 
// Open the app that responds to the URL scheme (should be Outlook). 
[[UIApplication sharedApplication] openURL:url]; 

Outlook的URL方案为:MS-展望://撰写[email protected] &主题=主题& body =消息

希望这会有所帮助!

+2

我发现你的答案真的很有帮助。唯一缺少的是关于附件。你能帮我吗? –