예제 #1
0
        private void testOneType(SPOClient spoc, SPOList spoList, string type, string name, string value)
        {
            SPOField field = spoc.GetFields(spoList).Where(n => n.Title == name).First();

            field.Value = value;
            List <SPOField> fields = new List <SPOField>()
            {
                field
            };
            int itemId = spoc.AddDocument(spoList, null, null, fields);

            field.Value = null;
            spoc.GetFieldValues(spoList, itemId, fields);

            if (value == string.Empty)
            {
                Assert.IsNull(fields[0].Value);
                return;
            }
            // My theory on how things work:
            // Client -> Server: csom takes string and gives it to SharePoint. It is parsed by SharePoints culture
            // Server -> Client: csom receives data and converts it to string according to current culture
            Assert.AreEqual(
                normalize(spoc.ClientCulture, type, value),
                normalize(CultureInfo.CurrentCulture, type, fields[0].Value));
        }
예제 #2
0
        public override void ExportDocument(SIEESettings settings, SIEEDocument document, string targetFileName, SIEEFieldlist fieldlist)
        {
            List <SPOField> fields = new List <SPOField>();

            foreach (SIEEField f in fieldlist)
            {
                SPOField spof = mySettings.Fields.Where(n => n.InternalName == f.ExternalId).FirstOrDefault();
                if (spof != null)
                {
                    spof.Value = f.Value;
                    fields.Add(spof);
                }
            }
            int itemId = spoClient.AddDocument(
                mySettings.SelectedList,
                getRelativePath(document) + targetFileName + ".pdf",
                document.PDFFileName,
                fields);

            document.TargetDocumentId = itemId.ToString();
        }
예제 #3
0
        private string convert(SPOField spoField)
        {
            switch (spoField.TypeName)
            {
            case "DateTime":
                if (string.IsNullOrEmpty(spoField.Value))
                {
                    return(null);
                }
                return(DateTime.Parse(spoField.Value, ClientCulture).ToString(serverCulture));

            case "Number":
            case "Currency":
                if (string.IsNullOrEmpty(spoField.Value))
                {
                    return(null);
                }
                return(float.Parse(spoField.Value, ClientCulture).ToString(serverCulture));

            default: return(spoField.Value);
            }
        }