public static Result AddListItem <T>(string listName, T obj) { string id = string.Empty; string itemPostBody = GenerateJsonFromObject.GenerateJson <T>(obj, out id); string DomainName = Convert.ToString(WebConfigurationManager.AppSettings["DomainName"]); string SiteUrl = Convert.ToString(WebConfigurationManager.AppSettings["SiteUrl"]); string accessToken = (HttpContext.Current.Request.Headers["Authorization"]).Split(' ')[1]; string errorLogPath = Convert.ToString(WebConfigurationManager.AppSettings["ErrorLogPath"]); Result res = new Result(); try { RestAPI.AddListItems(SiteUrl, errorLogPath, accessToken, Lists.ListURLs.RestUrlList(listName), Lists.ListURLs.RestUrlListItemWithQuery(listName, false), itemPostBody, Convert.ToString(GetUserInfo.UserID)); res.StatusCode = StatusCode.Success; res.Message = Messages.MsgSuccessAdd; return(res); } catch (Exception ex) { string guid = RestAPI.WriteException(ex, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name); throw new Exception(string.Format(Lists.Messages.MsgExceptionOccured, guid)); } }