public int GetWSSId(string url, string label) { using (var context = new SPContext(url, credentials.Get(url))) { try { var taxonomyList = context.Web.Lists.GetByTitle("TaxonomyHiddenList"); var taxItems = taxonomyList.GetItems(CAMLQueryBuilder.GetItemByTitle(label, new[] { "Title", "ID" })); context.Load(taxItems); context.ExecuteQuery(); if (taxItems.Any()) { return(taxItems[0].Id); } } catch (Exception ex) { SPLog.UnKnownError(ex, ex.Message); } } return(-1); }