-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add attributes to an XML node. #75
Comments
Hi, |
Thank you for your response; |
with this new version you can create sub-attributes, important: the sub-item is a dictionary with two keys named "value" and "attributes", where attribute is a dictionary. In future versions we will see how to simplify this process. NSDictionary @attr = @{@"Id": @"msgfolderroot"};
NSDictionary *value = @{@"value": @"", @"attributes": attr};
NSDictionary *child = @{@"t:DistinguishedFolderId": value};
[soap setValue:child forKey:@"ParentFolderId"]; |
@priore Thank you for making this possible! I will test this today ASAP to see if it works properly for my use cases. Have a nice day! |
@priore Tested and for the above request its working, but now I don't manage to send a soap action with attributes:
I cannot build this action.
Thanks for your support and patience! |
This is another enhancement to be added :) thanks |
@priore Ok, no problem, thanks a lot, I just want to manage to use your library in my code and EWS has complex soap stuff. |
added a method named |
@priore Thanks again! for support! |
@priore Hi, now i will test the new features that you integrated, I will come back if there is need for more support. |
@IuliuMoga, that is what we are here to do ;) You can find an example on the main page, look for the word "Attributes". |
@priore for example:
Get this response:
|
try to set |
@priore
FOR
Thanks. |
you can use the soap.envelope = @"xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\""; |
for multiple requests, you need to create multiple instances, note: the iOS has a limit of multiple http requests, search on google for this. |
I try to insert multiple <t:Mailbox> nodes and with NSArray its not working and with NSDictionary won;t let me to insert same key multiple times. |
for this complex cases, we recommend build data models, like below: @interface MainObject : NSObject
@property (nonatomic, strong) NSDictionary *SavedItemFolderId;
@property (nonatomic, strong) NSArray *Items;
- (void)setDistinguisedFolderId:(NSString*)value
attributes:(NSDictionary*)attr;
@end
@implementation MainObject
- (void)setDistinguisedFolderId:(NSString*)value
attributes:(NSDictionary*)attr
{
NSDictionary *distinguished = @{@"value" : value ?: @"", @"attributes": attr ?: @{}};
self.SavedItemFolderId = @{@"t:DistinguishedFolderId": distinguished};
}
@end
@interface t_Message : NSObject
@property (nonatomic, strong) NSString *ItemClass;
@property (nonatomic, strong) NSString *Subject;
@property (nonatomic, strong) NSDictionary *Body;
@property (nonatomic, strong) NSMutableArray *ToRecipients;
- (void)setBodyValue:(NSString*)value
attributes:(NSDictionary*)attr;
- (void)addEmailAddress:(NSString*)email;
@end
@implementation t_Message
- (void)setBodyValue:(NSString*)value
attributes:(NSDictionary*)attr
{
self.Body = @{@"value": value ?: @"", @"attributes": attr ?: @{}};
}
- (void)addEmailAddress:(NSString*)email
{
if (self.ToRecipients == nil)
self.ToRecipients = [NSMutableArray array];
NSDictionary *emailaddr = @{@"t:EmailAddress": email ?: @""};
NSDictionary *mailbox = @{@"t:Mailbox": emailaddr};
[self.ToRecipients addObject:mailbox];
}
@end and use it in this way: soap.defaultTagName = nil; // important!
soap.envelope = @"xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\"";
soap.prefixObjectName = @"t_";
soap.replacePrefixObjectName = @"t:";
t_Message *msg = [t_Message new];
msg.ItemClass = @"IPM.Note";
msg.Subject = @"Project Action";
[msg setBodyValue:@"Property - Update"
attributes:@{@"BodyText": @"Text"}];
[msg addEmailAddress:@"[email protected]"];
[msg addEmailAddress:@"[email protected]"];
MainObject *main = [MainObject new];
main.Items = @[msg, msg];
[main setDistinguisedFolderId:nil attributes:@{@"Id": @"drafts"}];
[soap setValue:main]; if it was necessary to specify the namespace (t:) in other tags we need to make new changes, let us know. |
@priore Ok, Thanks, and with this i think that everything is clear! |
@priore it Seems that we need to add for subject t:Subject and for body t:Body, i've prefixed their name with t_Subject and t_Body but they are listed in xml as t_Subject and t_Body, I think that some implementation must be added to support this complex types. |
Solved more simple: it Seems that we need to add for subject t:Subject and for body t:Body, i've prefixed their name with t_Subject and t_Body but they are listed in xml as t_Subject and t_Body, I think that some implementation must be added to support this complex types." I think i've solved it more simple:
|
yes, we found this problem, it is a bug, we fix it soon. |
@priore Hi, license purchased, what i need now is the possibility to add nodes for SOAP header from a Dictionary, I need to achieve this XML:
Thanks. |
you can set the property named Please, open a new issue for this new question, so that we can mark and manage it as "enhancement", and close current issue if the issue was solved, thanks. |
Hey, I want to start by saying "good library".
The authentication part works well, my actual problem is that I don't manage to build an XML for exchange web services, and I would love to buy license to use this library in my project.
Basicaly i try to achieve is this xml:
My question is how to combine soap setValue functions to achieve an xml node like this:
I keep trying to use all combinations but still Im not being able to build that xml for the envelope body and due this problem the server answers me back with a schema validation fail.
The text was updated successfully, but these errors were encountered: