I'm developing an add-in for Office with Angular using the Office Common API for Javascript, and I have to allow users to insert images at the current selection.
I'm using the following code:
private insertImage(asset: Asset, quality?: IAssetQuality): void {
this.getDownloadUrl(asset, quality).subscribe(url => {
const correctedUrl = this.getCorrectBase64Url(url);
Office.context.document.setSelectedDataAsync(correctedUrl,
{coercionType: Office.CoercionType.Image}, result => {
if (result.status === Office.AsyncResultStatus.Failed) {
console.error('failed to insert image', result);
}
});
}, err => console.log('Unable to retrieve downloadUrl:', err));
}
The code above works perfectly fine in all Office online application as well as in Microsoft Office 365 ProPlus, but it doesn't work in my local version of Office, which is Microsoft Office Standard 2016 for Windows. When reading through the documentation, it seems like ImageCoercion should be supported in Office 2016: https://learn.microsoft.com/en-us/office/dev/add-ins/overview/office-add-in-availability
Am I doing something wrong, or is it a mistake in the documentation?
Related
I am building a desktop app in .NET Maui which targets Windows and MacOS.
When using the built-in FilePicker on Mac (Catalyst) I get the following error:
{System.PlatformNotSupportedException: This platform does not support this file type. at Microsoft.Maui.Storage.FilePickerFileType.GetPlatformFileType(DevicePlatform platform) at Microsoft.Maui.Storage.FilePickerFileType.get_Value() at Microsoft.Maui.S…}
I have tried multiple file types, including csv, jpg, text/csv but nothing works.
public async Task ImportCSV()
{
try
{
var customFileType = new FilePickerFileType(
new Dictionary<DevicePlatform, IEnumerable<string>>
{
{ DevicePlatform.WinUI, new[] { ".csv" } },
{ DevicePlatform.macOS, new[] {"csv"} }
});
PickOptions options = new()
{
PickerTitle = "Please select a csv file",
FileTypes = customFileType
};
var file = await FilePicker.Default.PickAsync(options);
if (file != null)
{
string filePath = AppStateService.fixMacFilePath(file.FullPath);
AppStateService.AppState.csvFilePath = filePath;
await InitiateCsvMapping();
}
}
catch (Exception ex)
{
}
}
I am running Visual Studio Community 2022 for Mac Preview
Version 17.4 Preview (17.4 build 715)
The documentation does say that I should "Enable iCloud capabilities" but does not provide any links or other information regarding this. I did some digging, and found some documentation that says that it necessary to do this via the Entitlements.plist file (but there is none in the Maui project) and seems to only be relevant when publishing your app to the App store which I am not during development. I don't even care about iCloud right now. I just want to select a CSV file from my own desktop. Is this the problem? Thanks!!
Here is the article
I don't think it has something to do with ICloud. It is just the wrong file type. File types are different on MacOS.They are called UTypes.
I haven't tried but it is likely:
public.comma-separated-values-text
More Info here: commaSeparatedText
And maybe it is DevicePlatform.MacCatalyst instead of macOs.
I am in the process of upgrading an existing working Firebase Auth project to Identity Platform to benefit from the goodness of tenants.
I am currently testing this against the local emulator and am facing the following issues:
My users no longer show up in the emulator. I reckon, however, that
the behaviour is expected since I am creating users against a tenant
and no longer the default project users "pool"
The users do not show
up in the GCP console either. Yet, the getUserByEmail() method
in a Cloud Function returns the registered users. I therefore have no clue where these users are currently created...
Authenticating users via generateSignInWithEmailLink() works fine.
However, a few steps in the funnel after this, when using the await user?.getIdToken(true) method, I am getting the following error: Uncaught (in promise) FirebaseError: Firebase: Error (auth/invalid-refresh-token) and can't figure out why.
Interestingly, the user.getIdTokenResult() method works fine and does not yield any error.
My entire snippet:
const getCurrentUser = async (): Promise<Auth["currentUser"]> => {
return new Promise((resolve, reject) => {
const unsubscribe = onAuthStateChanged(
auth,
async (user) => {
if (user) {
if (document.referrer.includes("stripe")) {
// console.log({ user });
await user?.getIdToken(true);
console.log({ after: user });
}
state.isAuthenticated.value = true;
state.user.value = user;
try {
const { claims } = await user.getIdTokenResult();
state.claims.value = claims;
if (typeof claims.roles === "string") {
if (claims.active && claims.roles.includes("account_owner")) {
state.isActive.value = true;
}
}
} catch (e) {
console.log(e);
if (e instanceof Error) {
throw new Error();
}
}
}
unsubscribe();
resolve(user);
},
(e) => {
if (e instanceof Error) {
state.error.value = e.message;
logClientError(e as Error);
}
reject(e);
}
);
});
};
For reference, I am working with a Vue 3 / Vite repo.
Any suggestion would be welcome,
Thanks,
S.
Just a quick follow-up here for anyone looking for an answer to this.
I raised a bug report on the firebase-tools Github and:
Users not appearing in the Emulator UI: behaviour confirmed by the firebase team. The emulator does not not support multi-tenancy at the moment. In my experience, however, working with the emulator with multi-tenants, the basic functionalities seem to work: creating users, retrieving them. Impossible however to visualise them or export them.
Refresh token error: bug confirmed by the firebase team and in the process of being triaged. Will likely take some time before being fixed (if ever?). So for now, even if far from being ideal, I have added conditional checks to my code to skip the force refresh of the token on localhost. Instead, I log out and log back in with the users I am expecting to see some changes in the claims for, as this process does not error. Another solution would be to use an actual Firebase Auth instance and not the local emulator, but it feels a bit messy to combine localhost/emulator resources and actual ones, even with a dev account.
The GH issue: here.
I'm trying to build a POC Voice recognition app on the Tizen TV platform, but using Web application API I've failed at getting the permission for voice control.
Debug console prints: Cannot read property 'requestPermission' of undefined (in my case the global tizen object has no ppm property which in all examples on the Web should hold the requestPermission method).
function requestPermit(uri) {
return new Promise(function(resolve, reject) {
tizen.ppm.requestPermission(uri,
function(success) { resolve(success); },
function(error) { reject(error); });
});
}
var start = function() {
return requestPermit('http://tizen.org/privilege/voicecontrol.tts')
.then(function() { return init(); })
.catch(function(err) { return console.log(err); });
}
$(document).bind( 'pageinit', start );
As far as I know, the Privacy Privilege module of Web API is not supported on TV profile. There is no module Privacy Privilege on TV's docs here, so the behaviour you met is what I would expect - tizen.ppm is undefined.
Also basing on information here:
Since Tizen 4.0, the status of privacy-related privileges can be resolved at runtime using the Privacy Privilege API (in mobile and wearable applications).
There is no need to request a privilege on TV profile.
If you want to check in your code automatically, if the Privacy Privilege module is supported try:
if (tizen.systeminfo.getCapability("http://tizen.org/feature/security.privacy_privilege")) {
// ppm module is supported - you need to request privilege from the user here
} else {
// ppm module is not supported - just log or ignore, no consent from the user is needed
}
I have searched everywere and I am not able to find a proper resource where creating event in outlook-calender is done.Please,can someone provide me the code which creates a outlook-calender using Node.js
https://github.com/jasonjoh/node-outlook or https://www.npmjs.com/package/node-outlook looks like what you need.
This library provides a light-weight implementation of the Outlook Mail, Calendar, and Contacts APIs.
Sample code to create an event.
var outlook = require('node-outlook');
var newEvent = {
"Subject": "Discuss the Calendar REST API",
"Body": {
"ContentType": "HTML",
"Content": "I think it will meet our requirements!"
},
};
let createEventParameters = {
token: ['access token will come here'],
event: newEvent
};
outlook.calendar.createEvent(createEventParameters, function (error, event) {
if(error) {
console.log(error);
} else {
console.log(event);
}
});
https://github.com/jasonjoh/node-outlook looks like what you need. It requires Microsoft Office 365 APIs Client Libraries for Cordova Applications but that's pretty expected.
Is it possible to use SharePoint left navigation bar in a "Provider Hosted App". The navigation shown on SharePoint site "PlaceHolderLeftNavBar". Is there any way like some ajax call or REST/CSOM functionality?
According to the official MSDN documentation, the CSOM and JSOM both contain Navigation properties which also provide access to the quick launch menu (aka "left navigation bar").
Links to the docs are as follows:
SP.Navigation.quickLaunch property (sp.js) (JSOM)
Navigation.QuickLaunch property (CSOM)
In order to use either CSOM or JSOM in a provider hosted app, you would need to authenticate using either OAUTH (for Office 365 / SharePoint Online) or by using certificates in a High-Trust / on-premises environment.
If you use the App for SharePoint 2013 template provided by Visual Studio 2013, and select provider-hosted, it should come with a TokenHelper.cs/vb class file which will do much of the heavy lifting for both scenarios. More info on authentication techniques is also available on MSDN - look for the following topics in particular:
Authorization and authentication for apps in SharePoint 2013 How to:
Create high-trust apps for SharePoint 2013 (advanced topic)
I'm not sure if there is a pure REST endpoint available at this time, which could certainly simplify the advanced authorization requirements of CSOM / JSOM in a provider hosted app.
SP.Web.navigation property gets a value that specifies the navigation structure on the site, including the Quick Launch area and the top navigation bar
How to access Navigation (Quick Launch) via CSOM (JavaScript)
function getQuickLaunch(success,error)
{
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var nav = web.get_navigation();
var quickLaunch = nav.get_quickLaunch();
context.load(quickLaunch);
context.executeQueryAsync(
function() {
var nodes = [];
var nodesCount = quickLaunch.get_count();
for(var i = 0; i < nodesCount;i++){
var node = quickLaunch.getItemAtIndex(i);
nodes.push(node);
}
success(nodes);
},
error
);
}
Usage
getQuickLaunch(
function(nodes){
for(var idx in nodes)
{
console.log(nodes[idx].get_title());
}
},
function(sender, args) {
console.log('Error:' + args.get_message());
}
);
How to access Navigation (Quick Launch) via REST
function getQuickLaunch(siteurl, success, failure) {
$.ajax({
url: siteurl + "/_api/web/navigation/quickLaunch",
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
success(data.d.results);
},
error: function (data) {
failure(data);
}
});
}
Usage
getQuickLaunch(_spPageContextInfo.webAbsoluteUrl,
function(nodes){
for(var idx in nodes)
{
console.log(nodes[idx].Title);
}
},
function(error) {
console.log(JSON.stringify(error));
}
);