我使用的是Microsoft图形API。我打电话获取网站列表和响应,列出了所有可用的列表。然后使用list id来获取项目,但是没有项目显示在响应JSON的值字段中。列表中有项目,可以在SharePoint中看到。 API调用是获取项目 -
https://graph.microsoft.com/v1.0/sites/abc.sharepoint.com,{SPSite.ID},{SPWeb.ID}/lists/{list-id}/items
然后返回 -
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#sites('abc.sharepoint.com%2C792f04d7-8a76-4ccf-95fd-10e3293536c4%2Ca422fba2-947c-44ef-8134-ddd560d6bb3d')/lists('0c739bcd-8649-4fa6-bca4-a8dcea53e2c2')/items",
"value": []
}
要获取正在运行的列表 -
https://graph.microsoft.com/v1.0/sites/abc.sharepoint.com,{SPSite.ID},{SPWeb.ID}/lists/
并显示所有可用列表。
我指的是doc。
使用邮递员拨打电话。
由于
答案 0 :(得分:1)
尝试使用下面的测试查询工具来检查它是否有效。
在我的测试中使用下面的API。
// this is descriptive way to identify unique error types you may care about
enum ErrorType {
Unauthorized,
ServiceUnavailable,
ServiceError
}
// this class should bundle together enough information about an
// error that has occurred so consumers can decide how to respond
// e.g. is this a "fatal" error, or can the associated operation be
// retried?
class ErrorState {
public final ErrorType type;
public final boolean fatal;
ErrorState(ErrorType type, boolean fatal) {
this.type = type;
this.fatal = fatal;
}
}
// the Interceptor creates new instances of ErrorState and pushes
// them through the Subject to notify downstream subscribers
class ResponseCodeCheckInterceptor implements Interceptor {
private final Subject<ErrorState> errorStateSubject;
ResponseCodeCheckInterceptor(Subject<ErrorState> errorStateSubject) {
this.errorStateSubject = errorStateSubject;
}
@Override
public Response intercept(@NonNull Chain chain) throws IOException {
final Response response = chain.proceed(chain.request());
if(response.code() == HttpStatus.UNAUTHORIZED.value()) {
errorStateSubject.onNext(new ErrorState(ErrorType.Unauthorized, false));
} else if (response.code() == HttpStatus.INTERNAL_SERVER_ERROR.value()) {
errorStateSubject.onNext(new ErrorState(ErrorType.ServiceError, true));
} else if (response.code() == HttpStatus.SERVICE_UNAVAILABLE.value()) {
errorStateSubject.onNext(new ErrorState(ErrorType.ServiceUnavailable, false));
}
return response;
}
}
// the Presenter is created with a reference to the same Subject, but
// retains a reference to it as an Observable. the Consumer instance
// supplied as the onNext() handler is where you'd put your logic to
// handle ErrorStates. also, the Presenter should be lifecycle-aware
// so as to create and dispose of subscriptions at the appropriate
// times.
class Presenter {
private final Observable<ErrorState> errorStateStream;
private Disposable errorStateSubscription;
class Presenter(Observable<ErrorState> errorStateStream) {
this.errorStateStream = errorStateStream
}
public void onStart() {
errorStateSubscription = errorStateStream.subscribe(
next -> {
/* Invoke views/etc */
},
error -> {
/* handle stream error during */
}
);
}
public void onStop() {
if(errorStateSubscription != null) {
errorStateSubscription.dispose();
}
}
}
您还可以检查列表ID是否正确。