This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string getTranslatedText(string text) | |
{ | |
string host = "https://api.cognitive.microsofttranslator.com"; | |
string route = "/translate?api-version=3.0&to=en"; | |
string translatedText = ""; | |
System.Object[] body = new System.Object[] { new { Text = text } }; | |
var requestBody = JsonConvert.SerializeObject(body); | |
using (var client = new HttpClient()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string DetectLanguageFromText(string text) | |
{ | |
log.Info($"Got Text {text}"); | |
string detectedLanguage = ""; | |
var result = client.DetectLanguageAsync(new BatchInput( | |
new List<Input>() | |
{ | |
new Input("1", text) | |
})).Result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public TextAnalyticsProcessing(TraceWriter Log) | |
{ | |
log = Log; | |
log.Info("Text Processing Section Called"); | |
// Create a client. | |
client = new TextAnalyticsClient(new ApiKeyServiceClientCredentials()) | |
{ | |
Endpoint = "https://australiaeast.api.cognitive.microsoft.com" | |
}; //Replace 'australiaeast' with the correct region for your Text Analytics subscription | |
log.Info("Text Processing section initialized"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
let addorUpdateObj : any = { | |
AuthorId : customObj.user.id, | |
__metadata : { | |
'type': `SP.Data.CustomListItem` | |
} | |
} | |
console.log(`Sending object ${addorUpdateObj}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
let spHttpClient : SPHttpClient = context.spHttpClient; | |
let url = `${context.pageContext.web.absoluteUrl}/_api/web/lists/GetByTitle('${listTitle}')/Items?$select=Author/EMail,*&$expand=Author&$filter=Author/EMail eq 'XYZ@xyz.com'`; | |
spHttpClient.get(url, SPHttpClient.configurations.v1).then((response : SPHttpClientResponse) => { | |
if(response.ok) | |
{ | |
response.json().then((responseJson : any) => { | |
console.log(responseJson); | |
if (this.isValidObject(responseJson) && responseJson.value.length !== 0) { | |
resolve({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-PnPOnline -Url "https://sharepoint.com" | |
## Add Page using PnP PowerShell | |
$page = Add-PnPClientSidePage -Name "TestAppPart.aspx" -LayoutType SingleWebPartAppPage | |
## Add a section the Page | |
Add-PnPClientSidePageSection -Page $page -SectionTemplate OneColumnFullWidth | |
## Add a Client Side Web Part | |
Add-PnPClientSideWebPart -Page $page -DefaultWebPartType SiteActivity -Section 0 -Column 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class MasterComponent extends React.Component<MasterComponentProps, MasterComponentState> { | |
constructor() | |
{ | |
super(); | |
this._childSelect = this._childSelect.bind(this); | |
this.state= { | |
stateprop1 : null, | |
stateprop2 : true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import { ChildComponentState } from './ChildComponentState'; | |
import { WebPartContext } from '@microsoft/sp-webpart-base'; | |
export interface ChildComponentProps | |
{ | |
context : WebPartContext; | |
childoutput?: (item: any) => void; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Net.Http.Headers; | |
using System.Web; | |
using Newtonsoft.Json.Linq; | |
using System.Net.Http; | |
using Newtonsoft.Json; | |
using System.IO; | |
using Microsoft.Extensions.Logging; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Host; | |
using System.Collections.Generic; | |
using Newtonsoft.Json; | |
using Microsoft.Azure.WebJobs.Extensions.Http; | |
using System.Threading.Tasks; | |
using Microsoft.IdentityModel.Clients.ActiveDirectory; | |
using Microsoft.Extensions.Logging; |
NewerOlder