public ActionResult ScanForm() { var files = Request.Files; var username = Request.Params["username"]; var email = Request.Params["email"]; if (files == null || files.Count == 0 || String.IsNullOrWhiteSpace(username) || String.IsNullOrWhiteSpace(email)) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest)); } HttpPostedFileBase file = files[0]; FormInformation info = InfoPathAnalytics.FormInformation(file); info.Index = 1; UserDetail userDetail = new UserDetail { UserName = username, Email = email }; SubmitDiagnosticsResult(userDetail, file, info); return(View("DiagnosticsResult", info)); }
public ActionResult ScanTemplates(List <string> urls) { var spContext = SharePointContextProvider.Current.GetSharePointContext(System.Web.HttpContext.Current); var scanInfo = new ScanTemplateInfo(); var listInfo = new List <FormInformation>(); using (var clientContext = spContext.CreateUserClientContextForSPHost()) { foreach (var url in urls) { try { SP.Web web = clientContext.Site.RootWeb; var file = web.GetFileByServerRelativeUrl(url); FormInformation info = InfoPathAnalytics.FormInformation(clientContext, file); info.XsnUrl = file.ServerRelativeUrl; listInfo.Add(info); } catch { scanInfo.AddMessage(url); } } } scanInfo.FormInfos = listInfo; return(View(scanInfo)); }
public ActionResult ViewCount(string libraryUrl = null, string xsnUrl = null) { using (var clientContext = GetSharePointContext()) { return(new ObjectResult <Property>(InfoPathAnalytics.ViewCount(clientContext, libraryUrl, xsnUrl))); } }
public static async Task <ManifestFileWithProperties> ManifestWithProperties(ClientContext clientContext, string libraryUrl, string xsnUrl, string templateName, IStorageHelper storageContext, string instanceId = null) { if (templateName != null) { return(await GetManifestForTemplateName(templateName, storageContext, instanceId)); } return(InfoPathAnalytics.ManifestWithProperties(clientContext, libraryUrl, xsnUrl)); }
public ActionResult DataConnections(string libraryUrl = null, string xsnUrl = null) { using (var clientContext = GetSharePointContext()) { return(new ObjectResult <DataConnectionList>(InfoPathAnalytics.DataConnections( clientContext, libraryUrl, xsnUrl))); } }
public ActionResult FormSecuritySettings(string libraryUrl = null, string xsnUrl = null) { using (var clientContext = GetSharePointContext()) { return(new ObjectResult <FormPropertyList>(InfoPathAnalytics.FormSecuritySettings( clientContext, libraryUrl, xsnUrl))); } }
public ActionResult FormInformation(string libraryUrl, string xsnUrl) { using (var clientContext = GetSharePointContext()) { InfoPathServices.FormInformation info = null; info = InfoPathAnalytics.FormInformation(clientContext, libraryUrl, xsnUrl); SortFormInformation(info); return(new ObjectResult <FormInformation>(info)); } }
public ActionResult FormInformationFromFormFileRequest(FormFileRequest formFileRequest) { FormInformation fi = InfoPathAnalytics.FormInformationFromFormFileRequest(formFileRequest); if (string.Compare(formFileRequest.Format, "xml", true) == 0) { return(new XmlResult(fi)); } return(new JsonResult() { Data = fi, ContentEncoding = System.Text.Encoding.UTF8, ContentType = "application/json" }); }
public ActionResult AllFormPropertiesFromFormFileRequest(FormFileRequest formFileRequest) { FormPropertyList fpl = InfoPathAnalytics.AllFormPropertiesFromFormFileRequest(formFileRequest); if (string.Compare(formFileRequest.Format, "xml", true) == 0) { return(new XmlResult(fpl)); } return(new JsonResult() { Data = fpl, ContentEncoding = System.Text.Encoding.UTF8, ContentType = "application/json" }); }
public static async Task <FormFile> GetTemplateFileContents(ClientContext clientContext, string libraryUrl, string xsnUrl, string templateName, string instanceId, string fileName, IStorageHelper storageContext) { if (templateName != null || instanceId != null) { var blobInfo = await GetTemplateFile(templateName, instanceId, fileName, storageContext); if (blobInfo == null) { return(null); } var contents = await GetFileContents(blobInfo.FileStream); return(new FormFile(fileName, contents)); } return(InfoPathAnalytics.FormFileContents(clientContext, libraryUrl, xsnUrl, fileName)); }
public static async Task <PreprocessedViewFile> GetPreprocessedView( ClientContext clientContext, string libraryUrl, string xsnUrl, string templateName, string instanceId, string viewFileName, string format, string paramNames, string paramValues, IStorageHelper storageContext) { if (string.IsNullOrWhiteSpace(viewFileName)) { throw new ArgumentNullException("viewFileName", "View file name unspecified"); } if (!string.IsNullOrWhiteSpace(templateName)) { var templateFile = await GetTemplateFile(templateName, instanceId, viewFileName, storageContext); if (templateFile == null) { return(null); } var contents = await GetFileContents(templateFile.FileStream); return(InfoPathAnalytics.PreprocessedView(contents, viewFileName, paramNames, paramValues)); } return(InfoPathAnalytics.PreprocessedView( clientContext, libraryUrl, xsnUrl, viewFileName, format, paramNames, paramValues)); }
public static async Task <ActionResult> GetTemplateFile(ClientContext clientContext, string libraryUrl, string xsnUrl, string templateName, string instanceId, string fileName, IStorageHelper storageContext) { if (templateName != null || instanceId != null) { var blobInfo = await GetTemplateFile(templateName, instanceId, fileName, storageContext); if (blobInfo != null) { return(new FileStreamResult(blobInfo.FileStream, blobInfo.ContentType)); } return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } Stream stm = InfoPathAnalytics.TemplateFile( clientContext, libraryUrl, xsnUrl, fileName); return(new FileStreamResult(stm, InfoPathServices.Utilities.GetContentType(fileName))); }
public async Task <ActionResult> ScanTemplate(string templateName) { var scanInfo = new ScanTemplateInfo(); var listInfo = new List <FormInformation>(); if (string.IsNullOrEmpty(templateName)) { return(new EmptyResult()); } var spContext = SharePointContextProvider.Current.GetSharePointContext(System.Web.HttpContext.Current); using (var clientContext = spContext.CreateUserClientContextForSPHost()) { var blobInfo = await TemplateManager.GetXsnBlobInfo(templateName, StorageContext); if (blobInfo == null) { return(new EmptyResult()); } try { FormInformation info = InfoPathAnalytics.FormInformation(blobInfo.FileStream); info.XsnUrl = blobInfo.FileName; listInfo.Add(info); } catch { scanInfo.AddMessage(templateName); } } scanInfo.FormInfos = listInfo; return(View("ScanTemplates", scanInfo)); }
public ActionResult ScanTemplate() { var spContext = SharePointContextProvider.Current.GetSharePointContext(System.Web.HttpContext.Current); string spListId = this.Request["SPListId"]; string spListItemId = this.Request["SPListItemId"]; string relativeUrl = this.Request["url"]; using (var clientContext = spContext.CreateUserClientContextForSPHost()) { SP.File file = null; SP.Web web = clientContext.Web; clientContext.Load(web); if (string.IsNullOrEmpty(relativeUrl)) { Guid listId = new Guid(spListId); int itemId = Convert.ToInt32(spListItemId); SP.List spList = clientContext.Web.Lists.GetById(listId); clientContext.Load <SP.List>(spList); SP.ListItem item = spList.GetItemById(itemId); clientContext.Load <SP.ListItem>(item); clientContext.ExecuteQuery(); file = item.File; } else { file = web.GetFileByServerRelativeUrl(relativeUrl); } FormInformation info = InfoPathAnalytics.FormInformation(clientContext, file); info.XsnUrl = file.ServerRelativeUrl; return(View(info)); } }
public ActionResult PreprocessedViewFromFormFileRequest(FormFileRequest viewRequest = null, Dictionary <string, string> parameters = null) { return(new ObjectResult <PreprocessedViewFile>(InfoPathAnalytics.PreprocessedViewFromFormFileRequest( viewRequest, parameters))); }
public ActionResult ManifestWithPropertiesFromFormFileRequest(FormFileRequest formFileRequest) { return(new ObjectResult <ManifestFileWithProperties>(InfoPathAnalytics.ManifestWithPropertiesFromFormFileRequest( formFileRequest))); }