示例#1
0
        private void ListGetListInXml(bool inJSON)
        {
            // link to web service documentation
            // http://msdn.microsoft.com/en-us/library/lists.lists.getlist%28v=office.12%29.aspx

            XmlNode data     = null;
            var     listName = _dataManager.GetPropVal("ListName");

            using (var listSvc = new WorkEngineSolutionStoreListSvc.Lists())
            {
                // TODO: write a function to get user name and password
                listSvc.Credentials = new NetworkCredential("Solution1", @"J@(Djkhldk2", "EPM");
                listSvc.Url         = CoreFunctions.getFarmSetting("WorkEngineStore") + "_vti_bin/Lists.asmx";

                try
                {
                    ServicePointManager.ServerCertificateValidationCallback =
                        ((sender, certificate, chain, sslPolicyErrors) => true);

                    data = listSvc.GetList(listName);
                }
                catch (Exception ex)
                {
                    WriteLine(ex);
                    Response.Write($"{{ error : \"{ex.Message}\" }}");
                    return;
                }
            }

            Response.Write(!inJSON
                ? HttpUtility.HtmlEncode(data.OuterXml)
                : HttpUtility.HtmlEncode(JSONUtil.ConvertXmlToJson(XmlDataSimplifier.SimplifySPGetListXml(data), string.Empty)));
        }
示例#2
0
        private void ListGetListItemsInXml(bool inJSON)
        {
            XmlNode data;

            if (!TryGetListItemsInXml(out data))
            {
                return;
            }

            Response.Write(!inJSON
                ? HttpUtility.HtmlEncode(data.OuterXml)
                : HttpUtility.HtmlEncode(JSONUtil.ConvertXmlToJson(XmlDataSimplifier.SimplifySPGetListItemsXml(data), string.Empty)));
        }