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)); }
private void addDocument(SPOClient spoc, SPOList spol, string documentPath) { // fields should contain just the one custom column.. List <SPOField> fields = spoc.GetFields(spol).Where(n => n.Title != "Title").ToList(); // Set a field value and upload document foreach (SPOField f in fields) { f.Value = "Hello World!"; } int itemId = spoc.AddDocument(spol, documentPath, testDocument, fields); // Verify that the attribute is set foreach (SPOField f in fields) { f.Value = null; } spoc.GetFieldValues(spol, itemId, fields); foreach (SPOField f in fields) { Assert.AreEqual("Hello World!", f.Value); } //spoc.DeleteItem(spol, itemId); }