COM-Object for Teams Client - Microsoft.Office.Uc - com

I am trying to access Microsoft Teams client COM object.
As it was possible with Skype For Business with Lync client object in PowerShell.
Exactly opposite to this.
[Reflection.Assembly]::LoadFile("C:\temp\Microsoft.Lync.Model.dll")
[Reflection.Assembly]::LoadFile("C:\temp\microsoft.office.uc.dll")
$lyncclient = [Microsoft.Lync.Model.LyncClient]::GetClient()
$lyncclient2 = [Microsoft.Lync.Model.ContactInformationType]::Availability
$lyncclient.Self.Contact.GetContactInformation($lyncclient2);
This code results in presence of current Lync/Skype user.
$teamsClient = [Microsoft.Office.Uc.IUCOfficeIntegration]
$teamsClient.GetInterfaces()
Following small article https://www.msxfaq.de/teams/api/teams_presence.htm
I am not even able to recieve Com obj list in Get-ChildItem HKLM
only in Get-ChildItem HKCU.
My goal is to use the same functionality as Outlook does, to read presence of users in MS Teams.

Teams is still exposing a few functionalities via COM. Its implementing the IUCOfficeIntegration interface, so Microsoft Outlook can show the Teams availibility status of a contact in Outlook itself.
More Infos on how the Office Integration works can be found here.
https://github.com/MicrosoftDocs/office-developer-client-docs/blob/master/docs/shared/integrating-im-applications-with-office.md
I just describe quickly what i have done to receive availibility informations via COM.
Notice that this is C# code. I hope that it still helps.
Getting the ClassID of the Teams COM Class.
When Outlook and Teams is installed, Teams will register itself as an IM Application capable of providing availibility informations to Outlook. This is done by writing a few registry nodes. The ClassID can be found here
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\IM Providers\Teams
Getting Availibilities:
To do so i basically reversed all of the steps of the linked article showing how to implement a client for Office Integration, because i want to consume the Teams client.
Notice that the Lync SDK needs to be installed (https://www.microsoft.com/en-us/download/details.aspx?id=36824) because all of the Office Integration Interfaces are defined in it. (Reference to Microsoft.Office.Uc.dll needed). Maybe this library can be
class Program
{
static void Main()
{
var version = "15.0.0.0";
var teams = (IUCOfficeIntegration) new TeamsOfficeIntegration();
var client = (IClient) teams.GetInterface(version, OIInterface.oiInterfaceILyncClient);
var contactManager = client.ContactManager;
var uri = "name#company.com";
var contact = contactManager.GetContactByUri(uri);
var availibility =
(ContactAvailability) contact.GetContactInformation(ContactInformationType.ucPresenceAvailability);
}
[ComImport, Guid("00425F68-FFC1-445F-8EDF-EF78B84BA1C7")]
public class TeamsOfficeIntegration
{
}
}
I will try to upload a small project to GitHub to demonstrate....
As Powershell is based on .NET this should somehow be possible as well. Or a small C# Interop library could be written.

Teams does not use COM at all and never will.
We plan to support presence APIs in Microsoft Graph bit do not have a date to share.

Related

Field Validation in windows phone 8.1 universal app

In windows phone 8 we used System.ComponentModel.DataAnnotations to validate input in ViewModel and show validation error message in control tooltip. What is the equivalent way and best practice for validating input in windows phone 8.1 Universal app?
Since Windows 8.1 universal apps do not support Data Annotations, you can't use the [Required] and [RegularExpression] attributes to handle validation. If you take a look at the Prism for WinRT Universal Converged Branch on Codeplex, you'll note that even the Prism team's AdventureWorks Shopper app has the Data Annotations commented out due to lack of support in the Universal libraries provided by Microsoft.
In order to work around this, I wrote a simple (albeit verbose) approach to handling data validation. You can validate your model objects and the base class will handle notifying the UI bindinds that validation failed.
I have a blog post explaining why I went with this approach. The post is helpful for understanding why I wrote it how I did, but is a bit outdated from the actual source. The source comes with a sample Universal WinRT project targeting both Windows 8.1 and Windows Phone 8.1, with complete validation.
Any app that accepts input from users should ensure that the data is valid. An app could, for example, check that the input contains only characters in a particular range, is of a certain length, or matches a particular format. Without validation, a user can supply data that causes the app to fail. Validation enforces business rules, and prevents an attacker from injecting malicious data.
[Required(ErrorMessageResourceType = typeof(ErrorMessagesHelper), ErrorMessageResourceName = "RequiredErrorMessage")]
[RegularExpression(NAMES_REGEX_PATTERN, ErrorMessageResourceType = typeof(ErrorMessagesHelper), ErrorMessageResourceName = "RegexErrorMessage")]
public string FirstName
{
get { return _firstName; }
set { SetProperty(ref _firstName, value); }
}
http://code.msdn.microsoft.com/windowsapps/Prism-for-WinRTValidatableB-2acb9892
http://msdn.microsoft.com/en-us/library/windows/apps/xx130659.aspx

SharePoint feature event receiver not firing

I want to add a custom RoleDefinition to my sharepoint site, in VS2010 I added a new feature receiver and under the Activated Event I added this code:
using (SPSite site = new SPSite("http://localhost:8280"))
{
using (SPWeb web = site.OpenWeb())
{
web.RoleDefinitions.Add(AdminRole);
web.Close();
}
site.Close();
}
Using the package designer I added the feature and from VS I deploy the solution to the "Web" scope. when I go to site features I do see my feature being Active but the Role Definition is not there. I suspect the Event receiver code not being fired so I added some code that writes to a log file and there the file was empty so the code is never reached. knowing that the solution is deployed as a sandbox solution on SharePoint 2010.
any ideas?
Many thanks
The Event receiver did not fire because it was not linked to the feature...doh!
here is the thing, in the feature template file these two attributes must be added:
ReceiverAssembly="Full name, version, neutral,publikeytoken"
ReceiverClass="*Namesapace.classname"
hth
You created some code that got deployed within a feature. But you never do something to make that code run. I assume you have a business reason to do this in code in a feature, as the UI would let you do this sort of thing. Your code should actually be within a feature receiver if it is something you want to execute upon activating the feature. You would add this code to the override routine for the feature activating class.
Search for Feature receiver for detailed instruction.

How do I program a mobile app to send SMS?

I want a mobile app to send automated SMS. This will be in VB.Net. I've searched for articles on these but they are all about PC apps accessing a GSM modem or a mobile through a COM port. Is it the same process with mobile apps on the phone (not through a PC)? If yes, and I am to treat the GSM modem as a "port", how would I connect to it? If no, are there any useful resources for this?
Sending SMS is easy with windows mobile. You need a reference to mobile.poutlook namespace.
"Send SMS from Pocket PC, SMartphones, Windows mobile
To send an SMS Message we’ll first need to make reference to the Microsoft.WindowsMobile.PocketOutlook namespace.
Imports Microsoft.WindowsMobile.PocketOutlook
After that it’s as simple as creating a new instance of the SMSMessage class with an overloaded onstructor passing in the Recipient Mobile number and SMS text, then invoking the Send method"
Source.
Download VB code directly.
MS reference.
MS Snippet:
public void SmsMessageSend()
{
SmsMessage smsMessage = new SmsMessage();
//Set the message body and recipient.
smsMessage.Body = "Would you like to meet for lunch?";
smsMessage.To.Add(new Recipient("John Doe", "2065550199"));
smsMessage.RequestDeliveryReport = true;
//Send the SMS message.
smsMessage.Send();
return;
}
An automated VB translation of the above snippet:
Public Sub SmsMessageSend()
Dim smsMessage As New SmsMessage()
'Set the message body and recipient.
smsMessage.Body = "Would you like to meet for lunch?"
smsMessage.To.Add(New Recipient("John Doe", "2065550199"))
smsMessage.RequestDeliveryReport = True
'Send the SMS message.
smsMessage.Send()
Return
End Sub
The above is not VB as asked, but unfortunately MS does not provide the VB snippet there.
All this will only work, if you are using a windows mobile device. It will not work on windows ce devices.
You should consider your internet searches for mobile API and code. I always start with "compact framework" to get code related results only. Then I add the keywords I search for. In example: "compact framework send sms" gives a good result list that you can work on.

problems in accessing reservoir engineering data using Ocean API

I am building a plug in where I need to access the Reservoir engineering domain data using ocean API. I can access the development strategy using Simulation root but not been able to get the type of development strategy. Whether its history strategy or Prediction strategy.
Any way to know this information.
Unfortunately there is no Ocean API to access the type of the development strategy. I will add your use case to our requirement system.
Regards,
Carole
Having faced multiple limitations in Petrel RE API, and having to go through EclipseKeywordEditor a lot to achieve the goal, I have to say this is an easy one. DevelopmentStrategy.StrategyType property is there to help:
The following code is working for me on Petrel 2012.1:
SimulationRoot sroot = SimulationRoot.Get(PetrelProject.PrimaryProject);
DevelopmentStrategyCollection dsCol = DevelopmentStrategyCollection.NullObject;
if (sroot.HasDevelopmentStrategyCollection)
{
dsCol = sroot.DevelopmentStrategyCollection;
foreach (DevelopmentStrategy strat in dsCol.DevelopmentStrategies)
{
PetrelLogger.InfoOutputWindow(string.Format("{0} is a {1} strat",strat.Name,strat.StrategyType));
}
}
DevGuide doesn't list it, IntelliSense doesn't show it, yet you can bring up Object Browser and see it's actually there (grayed out in fact).

My application fails to create MAPI/Messaging profile properly using MAPI subsystem

I have an application which creates a MAPI profile to send mails/messages. The profile is getting created properly on Outlook2007 environment, but it is not getting created properly on Outlook2007 SP2 environment. Both the source code and "exchange environment to which MAPI/outlook profile" are same. The profile is created using MAPI subsystem.
Description about the application: The application is a windows service-based application. The service executes a COM application. The COM application spawns a new thread to create a new profile and sends a sample message.
Actual problem: During the profile creation, the call to the ConfigureMsgService function (that belongs to IMsgServiceAdmin) is not working properly even though it returns S_OK. The value for the 5th parameter "lpProps" of ConfigureMsgService function is given below.
// First, the mailbox name.
ZeroMemory(&rgval[0], sizeof(SPropValue) );
rgval[0].ulPropTag = PR_PROFILE_UNRESOLVED_NAME;
rgval[0].Value.lpszA = szMailbox;
// Next, the server name.
ZeroMemory(&rgval[1], sizeof(SPropValue) );
rgval[1].ulPropTag = PR_PROFILE_UNRESOLVED_SERVER;
rgval[1].Value.lpszA = szServer;
// For NT Services, need to do this to keep MAPI from
// displaying dialog boxes.
ZeroMemory(&rgval[2], sizeof(SPropValue) );
rgval[2].ulPropTag = PR_CONVERSION_PROHIBITED; //As the com application is executed by the NT service, this parameter is specified.
rgval[2].Value.b = TRUE;
Also note, prior to ConfigureMsgService function call, all the other MAPI calls such as MAPIInitialize, MAPIAdminProfiles, CreateProfile, AdminServices, CreateMsgService, GetMsgServiceTable etc are succeeded.
My question, the same code was working properly with Outlook 2007 environment, but it failed in Outlook 2007 SP2 environment.
Please note,
1. when the same code is executed from a stand-alone application, it worked fine.
2. The code didn't work properly if the service is executed as a Local System account or as a network service account.
What could be the problem? Am I missing some thing.
Is there any work-around is available?
Thanks in advance
Saravanan
Your problem is in #2 of your note:
Please note, 1. when the same code is
executed from a stand-alone
application, it worked fine. 2. The
code didn't work properly if the
service is executed as a Local System
account or as a network service
account.
MAPI profiles are stored in the current user's hive* in the registry (HKEY_CURRENT_USER and HKEY_USERS{user SID}). The system accounts (LocalSystem and NetworkService) don't present a user hive which MAPI needs to write the profile information.
The easiest fix is to have your service run under a user account which has been granted the Log On As Service right. Depending on how your COM app is run as (in proc vs out of proc) you may be able to have it run as a specific user instead of a system account.
*Hive is the term used for the different sections of the registry. Here we're just dealing with the user's own section of the registry.
Thanks for your reply.
I tried your idea, but it doesn't worked. I spoke to Microsoft in this case, they have provided a fix for this issue(http://support.microsoft.com/kb/972363), it fixed it.
Saravanan