To programmatically retrieve the start and end times of Skype calls, you can use the Skype for Business API or the Microsoft Graph API, depending on whether you're working with Skype for Business or Skype's consumer version. Here’s a general approach for both:
For Skype for Business
Use Skype for Business API: This API allows you to interact with Skype for Business Online. You can retrieve call records by accessing the conversation history of a user.
Authentication: First, you'll need to authenticate using OAuth with the credentials of a user or an admin.
Fetch Conversation History: Make API calls to get the conversation history, which includes call start and end times. You can use endpoints like /communication/conversations
to fetch this data.
Extract Time Data: From the conversation details, extract the start and end times of each call.
For Skype Consumer Version
Microsoft Graph API: Since direct Skype APIs for consumer versions do not offer detailed call data, you might consider using Microsoft Graph API if the accounts are linked with Microsoft 365.
Authentication: Authenticate using OAuth 2.0. You'll need appropriate permissions to access user data.
- Call Records: Use the
/communications/callRecords
endpoint to fetch call records. Note that this primarily applies to Microsoft Teams and might have limited functionality for Skype consumer calls. - Parsing Data: After retrieving the call records, parse the JSON response to extract the necessary timing data.