private static void TestShareGroups(MyUser user, Album myAlbumTitleOnly) { Console.WriteLine("Test the sharegroup methods"); ShareGroup myShareGroup = null; ShareGroup myShareGroupWithDescription = null; try { // Create a sharegroup without description myShareGroup = user.CreateShareGroup("TestShareGroup"); } catch (Exception e) { Console.WriteLine(e); } try { // Create a sharegroup with description myShareGroupWithDescription = user.CreateShareGroup("TestShareGroupWithDescription", "Something for testing"); } catch (Exception e) { Console.WriteLine(e); } // Get a list of sharegroups and display it var myShareGroupsList = user.GetShareGroups(true); foreach (var x in myShareGroupsList) { Console.WriteLine(x.Name + ' ' + x.Description + ' ' + x.URL); } try { // Retrieving info about a sharegroup from the site by creating a new sharegroup in which it will be stored myShareGroup = myShareGroup.GetInfo(); Console.WriteLine(myShareGroup.Name + ' ' + myShareGroup.Tag); } catch (Exception e) { Console.WriteLine(e); } try { // Retrieving info about a sharegroup from the site by populating the current object myShareGroupWithDescription.PopulateShareGroupWithInfoFromSite(); Console.WriteLine(myShareGroupWithDescription.Name + ' ' + myShareGroupWithDescription.Tag); } catch (Exception e) { Console.WriteLine(e); } try { // Add an album to a sharegroup myShareGroup.AddAlbum(myAlbumTitleOnly); Console.WriteLine("Number of albums on sharegroup: " + myShareGroup.AlbumCount); } catch (Exception e) { Console.WriteLine(e); } // Get the albums that a sharegroup has var myShareGroupAlbums = myShareGroup.GetAlbums(); foreach (var x in myShareGroupAlbums) { Console.WriteLine(x.Title); } try { // Remove an album from a sharegroup myShareGroup.RemoveAlbum(myAlbumTitleOnly); Console.WriteLine(myShareGroup.AlbumCount); } catch (Exception e) { Console.WriteLine(e); } try { //Deleting a sharegroup myShareGroup.Delete(); myShareGroupWithDescription.Delete(); } catch (Exception e) { Console.WriteLine(e); } Console.WriteLine(); }