を構築し、私は新しいSharePointフレームワークを使用して、SharePointのWebパーツを作成しようとしている表現で「新しい」を使用することはできませんサンプルです私はreferenceのために使用しています。活字体は、ここで <a href="https://dev.office.com/sharepoint/docs/spfx/web-parts/guidance/call-microsoft-graph-from-your-web-part" rel="nofollow noreferrer">as shown here:</a></p> <p>マイクロソフトグラフを使用しており、そのタイプのコールが欠けているか、署名
私はsharepointのyeomanジェネレータを使って新しいプロジェクトを作成しました。
インストールアダル:NPMアダルためアダル-角度
インストールタイピングをインストール:
:タイピングがインストールアダル--source DT --global --saveはWebPart.tsxファイルから関連する部分をコピーし
const AuthenticationContext = require('adal-angular');
import adalConfig from '../AdalConfig';
import { IAdalConfig } from '../../IAdalConfig';
import '../../WebPartAuthenticationContext';
export default class ReactClient extends React.Component<IReactClientProps, IReactClientState> {
private authCtx: adal.AuthenticationContext;
constructor(props: IReactClientProps, state: IReactClientState) {
super(props);
}
this.state = {
loading: false,
error: null,
signedIn: false
};
const config: IAdalConfig = adalConfig;
config.popUp = true;
config.webPartId = this.props.webPartId;
config.callback = (error: any, token: string): void => {
this.setState((previousState: IReactClientState, currentProps: IReactClientProps): IReactClientState => {
previousState.error = error;
previousState.signedIn = !(!this.authCtx.getCachedUser());
return previousState;
});
};
this.authCtx = new AuthenticationContext(config);
AuthenticationContext.prototype._singletonInstance = undefined;
}
ライン:
private authCtx: adal.AuthenticationContext;
には、adalタイプファイルで作成された名前空間adalを識別する問題はありません。
しかし、ライン:
this.authCtx = new AuthenticationContext(config);
は私にエラーを与える:そのタイプのコールが欠けているか、構築署名
コンストラクタアダルタイプのファイルであり表現で「新しい」を使用することはできません。私は何が欠けているのか分からない。私は皆さんのうちの一人が私のためにそれに光を当てることを望んでいます。
おかげで、
ありがとう、mason。それは私が問題を理解している部分です。私は 'new adal.AuthenticationContext(config)'に名前空間が必要であると予想していましたが、この例では名前空間 'new AuthenticationContext(config)'がなくても構いません。私はスペースのために輸入品を捨てました。私はそれらを含めるようにOPを更新します。混乱させて申し訳ありません。 – stevepra