I am creating a app for Microsoft Teams. I am trying to create a tab using microsoft graph post api.
/teams/${teamId}/channels/${channelId}/tabs payload is an object with following params:
{
displayName: 'My Tab'
'teamsApp#odata.bind': 'https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.web',
configuration: {…},
};
Currently creating Tab with tab name 'My Tab'. How can I prepend a image along with name. e.g. '+image+ My Tab'.
There is no way to add image with displayName in Teams Tab.
This is by design.
Ref Doc : https://learn.microsoft.com/en-us/graph/api/channel-post-tabs?view=graph-rest-1.0
Could you please raise an user voice here:
Microsoft Teams Community
Related
I have successfully created an onlineMeeting object by using MS Graph API
POST /users/{userId}/onlineMeetings
I can extract the joinWebUrl (or the joinUrl, both seem to be the same) and get it to open on a new tab, which gives a popup asking whether I should open the Teams App on my system to join the meeting. If I say yes, the Teams App opens up and I can join the meeting through it. If I say no, the Teams launcher page is opened, where I can
a. Download the app
b. Continue on the browser, or
c. Open Teams.
My question is, how can I get the meeting opened up directly on the browser, bypassing the popup and the launcher page? Everywhere I search, questions are on how to open the meeting directly in the app, but I need it the other way around, in the browser. Is this possible through code?
I'm including my graph API code below, even though it might not be relevant.
let data = {
"startDateTime": "2022-08-16T13:20:34.2444915-07:00",
"endDateTime": "2022-08-16T13:25:34.2444915-07:00",
"subject": "Teams Meeting"
}
let payload = await fetch("https://graph.microsoft.com/v1.0/users/{userId}/onlineMeetings", {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + tokenResponse.accessToken,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
let json = await payload.json();
window.open(json.joinWebUrl);
The default behavior is: it open the Teams launcher page:
Here, you can click on checkbox to always open the links in associated app but we don't have any option to always open it in browser.
I am creating a app for Microsoft Teams. I am trying to create a tab using microsoft graph post api.
/teams/${teamId}/channels/${channelId}/tabs payload is an object with following params:
{
displayName: 'My Tab'
'teamsApp#odata.bind': 'https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.web',
configuration: {…},
};
Currently creating Tab with tab name 'My Tab'. How can I prepend a unicode logo along with name. e.g. '+unicode-logo + My Tab'. Unicode logo is available to a particular font file.
There doesn't seem to be any way to add unicode logo along with name while creating tab using Graph API. Supported type is string.
Ref: https://learn.microsoft.com/en-us/graph/api/resources/teamstab?view=graph-rest-1.0#properties
I'm currently having major issues with creating teams from the Graph API. I was initially trying to create teams based on groups, however I have found out today that you can now create a team without creating a group first then waiting 15 minutes to then create the team from the following link. This would make things considerably simpler.
https://learn.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0
I am using the Microsoft.Graph SDK (v3.12.0 released 26th Aug) so replicated the http call using the SDK as follows.
var team = new Team
{
DisplayName = "My Group Name",
Description = "My Group Description",
AdditionalData = new Dictionary<string, object>()
{
{"template#odata.bind", "https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')"},
{"owners#odata.bind", $"[\"https://graph.microsoft.com/v1.0/users('{usersGuid}')\"]"}
},
};
var response = await _graphClient.Teams
.Request()
.AddAsync(team);
The code above gives a:
[16:14:01 ERR] An unhandled exception has occurred while executing the request.
Status Code: BadRequest
Microsoft.Graph.ServiceException: Code: BadRequest
Message: Invalid bind property name owners in request.
If I remove the line
{"owners#odata.bind", $"[\"https://graph.microsoft.com/v1.0/users('{usersGuid}')\"]"}
from the code I get the following:
ErrorMessage : {"errors":[{"message":"A team owner must be provided when creating a team in application context."}]
Any advice would be greatly appreciated.
Thanks,
Nick
In v1.0 the owners relationship is not currently present, so you have to use the beta endpoint.
POST: https://graph.microsoft.com/beta/teams
with the following body format
{ "template#odata.bind":"https://graph.microsoft.com/beta/teamsTemplates('standard')", "displayName":"Test Team", "description":"Test description", "owners#odata.bind":["https://graph.microsoft.com/v1.0/users/{user guid}"] }
Note: the user guid should also be bare, i.e without the brackets and quotes in your example.
I want to create Ads by using Facebook Published page post. For this process, I'm able to get all Published Posts of a Page through graph API (page_id/posts). Also, I can create ad creative along with the Post_Id. However, When I use this created ad_creative id in the Ad creation process, it through this error "Invalid parameter: Ad Creative Does Not Use Valid Link."
For Doc... references: https://developers.facebook.com/docs/marketing-api/reference/ad-creative#obtaining_pp Also for generating the ad, I used this method.
ad = ad_account.ads.create({
name: ' Ad* via Post',
adset_id: under_adset_id,
creative: {
creative_id: post_creative_id,
},
status: 'PAUSED',
})
Add 'link' field to request
creative: { creative_id: post_creative_id, link: "https://stackoverflow.com/"},
I was looking to add members to Project using REST API.
I was able to create project using API:
POST https://{instance}/{collection}/_apis/projects?api-version=5.0
Also, I was able to create a team in a project using REST API:
POST https://{instance}/{collection}/_apis/projects/{projectId}/teams?api-version=5.0
However, I was not able to get a REST API to add members to team and project.
Can you please help?
Devops server 2019 - Is there an REST api to add members to project
and team
For this issue,I think there is no out of box rest api to achieve it . The Members - Add rest api is currently not available for Azure DevOps Server 2019.
As a workaround ,we can track this rest api by press F12 in browser then select Network.
Sample request url :
https://collectionName/DefaultCollection/projectId/_api/_identity/AddIdentities?__v=5
Sample request body:
{
"newUsersJson": "[]",
"existingUsersJson": "[\"55b98726-c6f5-48d2-976b-xxxxxx\"]",
"groupsToJoinJson": "[\"7283653f-54b2-4ebf-86c3-xxxxxxx\"]",
"aadGroupsJson": "[]"
}
In this step ,you need to convert the name of the member you want to add and the name of the team to json, then add to the request body. Here is a case states how to convert a string to JSON in C#.
From this record ,we can get the request url and request body.
I test this with postman and can successfully add a member to a project team.
Here are two cases(case1 , case2) with similar problems. You can also refer to them.
The use voice instance in the above case is no longer available. You could submit a new one to our main forum for product suggestions. Our PM and Product Group are reviewing these suggestion regularly and considering take it as plan.
The REST API to add members to projects and team is not documented. As Hugh mentioned we can track the REST API with develop tools (press F12 in browser), however as we can see we can only use the user and team/group GUID in the request json body.
Post https://wsicads2019/DefaultCollection/{project}/_api/_identity/AddIdentities?api-version=5.0
Request Body:
{
"newUsersJson": "[]",
"existingUsersJson": "[\"55b98726-c6f5-48d2-976b-xxxxxx\"]",
"groupsToJoinJson": "[\"7283653f-54b2-4ebf-86c3-xxxxxxx\"]",
"aadGroupsJson": "[]"
}
For the specific team/groups we can use the REST APIs Projects and teams to get their GUID.
For the user, actually it's used the TeamFoundationId, the unique TeamFoundationId is automatically generated when a user is added to Azure DevOps Server. We cannot generate the ID with external tools.
So, to use that REST API, we need to get the TeamFoundationId of the specific user which you want to add it to the projects/teams.
Currently, no REST API to list TeamFoundationId of the users in Azure DevOps Server 2019, however we can get it with Client API:
Below sample for your reference to get the TeamFoundationId of a specific user: (It will also export the user list with their TeamFoundationId to userlist.txt)
using System;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Framework.Client;
using Microsoft.TeamFoundation.Framework.Common;
using System.Linq;
using System.IO;
namespace Getuserlist
{
class Program
{
static void Main(string[] args)
{
TfsConfigurationServer tcs = new TfsConfigurationServer(new Uri("https://wsicads2019"));
IIdentityManagementService ims = tcs.GetService<IIdentityManagementService>();
TeamFoundationIdentity tfi = ims.ReadIdentity(IdentitySearchFactor.AccountName, "[DefaultCollection]\\Project Collection Valid Users", MembershipQuery.Expanded, ReadIdentityOptions.None);
TeamFoundationIdentity[] ids = ims.ReadIdentities(tfi.Members, MembershipQuery.None, ReadIdentityOptions.None);
using (StreamWriter file = new StreamWriter("userlist.txt"))
foreach (TeamFoundationIdentity id in ids)
{
if (id.Descriptor.IdentityType == "System.Security.Principal.WindowsIdentity" && id.UniqueName == "Domain\\User")
{ Console.WriteLine("[{0},{1}]", id.UniqueName, id.TeamFoundationId); }
file.WriteLine("[{0},{1}]", id.UniqueName, id.TeamFoundationId);
}
var count = ids.Count(x => ids.Contains(x));
Console.WriteLine(count);
Console.ReadLine();
}
}
}