Cannot create group in openfire via SMACK API - smack

Unfortunately I am not able to create a group in openfire 3.8.2 via the SMACK API (3.2.1).
Here is what I am desperately trying to do:
Roster roster = connection.getRoster();
RosterGroup group = roster.createGroup("FancyName");
roster.createEntry(connection.getUser(), "nickname", new String[] { group.getName() });
RosterEntry user = roster.getEntry("user#domain");
group.addEntry(user);
And that's it.
Afterwards there is no group in openfire.
What do I do wrong?
With thanks

Tested your code with the application I'm developing and it creates the group + adding the users.
The problem with your code is that the group that you are creating is specific to each user roster, and will not be appearing in Openfire's Groups tab.
From what I've experienced with Smack/Openfire, the shared roster groups (those that you want to see in Openfire) cannot be created from the client side using Smack API.

Related

Facing problem in Create AD user using Microsoft Graph APIs

I have to use Microsoft Active Directory APIs to create an active directory account which will then be synced with Azure. I am using Microsoft Graph SDK for PHP to implement the functionality.
Created APP in AD account
Retrieved TenantId, ClientId and Secreat keys.
Using SDK, retrieved access token.
Next called function to create user.
Here I initially got permission related issues. In AD APP, I gave full permission for directory read. In permissions section I could not find any permission option related to Create User. Also in "Microsoft Graph SDK for PHP", while using create user function, I am getting "Class 'User' not found in D:\xampp\htdocs\test\vendor\microsoft\microsoft-graph\src\Http\GraphResponse.php" error.
Here I would like to confirm if this is possible to create an active directory account which will then return license key in response to be used by the newly created user?
Any help would be greatly appreciated.
Many Thanks.
The permissions required for creating the user:
The request body for creating the user:
please refer this example:
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new User();
$requestBody->setAccountEnabled(true);
$requestBody->setDisplayName('Adele Vance');
$requestBody->setMailNickname('AdeleV');
$requestBody->setUserPrincipalName('AdeleV#contoso.onmicrosoft.com');
$passwordProfile = new PasswordProfile();
$passwordProfile->setForceChangePasswordNextSignIn(true);
$passwordProfile->setPassword('xWwvJ]6NMw+bWH-d');
$requestBody->setPasswordProfile($passwordProfile);
$requestResult = $graphServiceClient->users()->post($requestBody);
Hope this helps.

MS Graph Mail The specified object was not found in the store

I am trying to retrive information about mails within a users mailbox.
I am using the following snippet of code:
graphClient.Users[mailbox]
.Messages[messageId]
.Request()
.GetAsync()
.Result;
Which works fine for the most requests.
The messageId is read previously from the graph API.
The app registration has the following permissions.
Found this: using microsoft graph api to read mail behalf of users in the enterprise -> I'm using the application login method.
MessageId's change when an item is moved between folders so it most likely that is the reason your having the problem. To solve it use the immutableid https://learn.microsoft.com/en-us/graph/outlook-immutable-id

Microsoft.Graph Subscriptions - Exchange Online resources are not supported for MSA requests

I am attempting to write a service to take an action when a calendar event occurs. ie Appoint due in 15 min warning. Multiple users will need to be able to register with the service. I think Subscriptions are the what I need, although what "ChageType" to use to get an alert, I have not gotten to yet. Right now I get "Exchange Online resources are not supported for MSA requests." when I try to use this code. I am working against an outlook.com account.
GraphServiceClient graphClient = SDKHelper.GetAuthenticatedClient();
var subscription = new Microsoft.Graph.Subscription();
subscription.ChangeType = "updated";
subscription.ExpirationDateTime = System.DateTime.UtcNow.AddDays(1);
subscription.ClientState = System.Guid.NewGuid().ToString();
subscription.NotificationUrl = "https://mywebhook.azurewebsites.net/api/send/myNotifyClient"; // must be valid and able to verify?
subscription.Resource = "me/events";
var newsub = await graphClient.Subscriptions
.Request().AddAsync(subscription);
Subscriptions to Outlook.com ARE supported by the nugget package: Microsoft.Office365.OutlookServices-V2.0
that wraps the Outlook365 API.
https://msdn.microsoft.com/en-us/office/office365/api/notify-rest-operations
I got it working -- sort of using:
https://github.com/jasonjoh/dotnet-tutorial
combined with:
aspnet-webhooks-rest-sample
So far I can create a subscription using an MVC App and capture User Info + Client State; at the webhook I can capture client state and subscription id along with a Change Type and Resource ID:
https://outlook.office.com/api/v2.0/Users('0003bffd-a898-60b1-0000-000000000000#84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa')/Messages('AQMkADAwATNiZmYAZC1hODk4LTYwYjEtMDACLTAwCgBGAAADhL94GyFZe0WMH6_2kacBNAcAVYqcEoTpoEy-bsETzU244wAAAgEKAAAAVYqcEoTpoEy-bsETzU244wAAAFP_o9AAAAA=')
Unfortunately, no information about the "item" is provided.
Update: using info from MVC 5 application - implement OAuth Authorization code flow I am able to get "Authorization Code Flow" working - still need to figure out how to Authenticate OWIN (so the MVC app has a Logon Identity) using an access_token.
It is currently not supported to use MS accounts for subscriptions on several resources. Instead the mailbox must use a "work or school" account.
See https://stackoverflow.com/a/41026203/270142 for further details.

Setting up Google Calendar API

I'm trying to use the Google Calendar API in one of my projects. To do so, I need to set up OAuth access in the Google API console.
But when creating the consent-form (which is required to use OAuth), I get a meaningless error message:
The translation is as follows:
A problem occured. Please check your data and try again . If you have
not given any details, the problem may solve itself . In this case, we
recommend that you wait and try again later.
I have set the E-Mail address and project name. The optional fields were left blank.
So far I have not been able to solve the problem. I tried to wait for hours/days. I tried three different browsers. I also tried to contact Google support. All without success.
After days of trying, this is the solution:
Create another Google account
Using your old account, add the new account as an owner to your Google API project in the console
Log in with your new user account and accept the invitation
Create the OAuth consent form with the new user account
I have no idea WHY this worked, but it did.

Is it possible to create group chat dialog/room from the server instead of client?

I am using ruby on rails at server side. I want to use quickblox as chat solution. And my requirement is to create group chat room from the server side instead of client side(android, ios). I am able to register user from the backend, but the issue is I am getting the following error, while creating a chat dialog, from the server.
I am using this link for integrating the quickblox api:
http://quickblox.com/developers/Chat#Create_dialog
Error {"errors":{"base":["Forbidden. Need user."]}}.
To create a dialog you need to be logged in
Use next request http://quickblox.com/developers/Authentication_and_Authorization#API_User_Sign_In

Resources