SPConnector 设计为在保持轻量化的同时提供 SharePoint 功能。
它本身不处理网络连接,并旨在在这个方面提供灵活性。
未来还将提供更多 SharePoint 操作。
NSURL *url = [NSURL URLWithString:@"http://sharepoint.example.com/"];
NSURLCredential *credential = [credentialWithUser:@"username"
password:@"password"
persistence:NSURLCredentialPersistenceNone];
self.ctx = [[SPContext alloc] initWithSiteURL:url];
[self.ctx setRequestSetupBlock:^(SPURLConnectionOperation *requestOperation) {
// Called when a new request is allocated
[requestOperation setAuthenticationChallengeBlock:^(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge) {
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
}];
}];
[self.ctx getListCollection:^(NSArray *lists, NSError *error) {
for (SPList *list in lists) {
NSLog(@"%@", list.title);
}
}];
SPConnector 在 MIT 许可协议下可用。有关更多信息,请参阅 LICENSE 文件。