NuGet package for Yammer Export API

Hi,

I have developed a NuGet package that helps exporting data from Yammer. It’s a simple .NET wrapper that consumes the Yammer export API. It allows you to retrieve either :

  • Files (metadata only or metadata+binaries)
  • Administrators
  • Groups
  • Inbound Threads, meaning external messages in which internal users take part
  • Outbound Threads, meaning internal messages in which external users take part
  • Messages
  • Networks
  • Topics
  • Pages
  • Users

or everything at the same time. The wrapper aligns on the REST API and allows to specify a starting date. When no date is specified, the entire dataset will be exported. The latter is to be used with caution, especially if you include the binaries. When including binaries, they’re extracted locally in a default folder or in a folder of your choice. From there on, you have two possibilities:

  • Extract the binaries locally and access them. The YammerFile class will indicate where the file was extracted via the LocalPath property.
  • Extract the binaries into an Azure Storage (the wrapper uploads the Yammer blobs right into a storage account of your choice). Even for this one, each blob is first extracted locally temporarily and then moved to the storage.

The wrapper is very intuitive to use.

YammerClient cli = new YammerClient("api key");

You first need to instantiate a YammerClient and provide the api key (the access token that will be used to consume the Yammer REST API). This must be an admin-like token.

Then, you can simply configure the options of your client:

yammercli

where:

  • ExportBinaries is a boolean
  • ExportPath is the path where you want the files to be extracted. If none is provided, it will take the current directory
  • logs are a collection of log entries to track what happened when uploading the blobs into Azure

Here is a full example of file import (metadata+binaries)

YammerImportHelper imp = new YammerImportHelper(cli);
List files = imp.GetFiles(DateTime.Now.AddDays(-50));

foreach (YammerFile file in files)
{
  Console.WriteLine(file.name + " " + file.local_path);
}
foreach (YammerExportLogEntry log in cli.logs)
{
  Console.WriteLine(log.message);
}

The package is available on https://www.nuget.org/packages/Eyskens.YammerExportAPIWrapper/ and can simply be installed using the NuGet console.

So, easy to use and granular!

Happy Coding

Advertisements

About Stephane Eyskens

Office 365, Azure PaaS and SharePoint platform expert
This entry was posted in Open Source, Yammer and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s