I have these two code snippets:
- public void AddDocumentSet(string siteUrl, string libName, string docSetName, string mSISDN, string accountNumber, string hardCopyLocation, string verifiedBy, DateTime veriDate)
- {
- ClientContext clientContext = new ClientContext(siteUrl);
- Web web = clientContext.Web;
- List byTitle = clientContext.Web.Lists.GetByTitle(libName);
- clientContext.Load<Site>(clientContext.Site);
- ContentTypeCollection contentTypes = byTitle.ContentTypes;
- clientContext.Load<ContentTypeCollection>(contentTypes, (Expression<Func<ContentTypeCollection, object>>) (types => ClientObjectQueryableExtension.Include<ContentType>(types, new Expression<Func<ContentType, object>>[]
- {
- (Expression<Func<ContentType, object>>) (type => type.Id),
- (Expression<Func<ContentType, object>>) (type => type.Name),
- (Expression<Func<ContentType, object>>) (type => type.Parent)
- })));
- IEnumerable<ContentType> source = clientContext.LoadQuery<ContentType>(Queryable.Where<ContentType>((IQueryable<ContentType>) contentTypes, (Expression<Func<ContentType, bool>>) (c => c.Name == "Earchive document")));
- clientContext.ExecuteQuery();
- ContentType contentType = Enumerable.FirstOrDefault<ContentType>(source);
- ListItem listItem = byTitle.AddItem(new ListItemCreationInformation()
- {
- UnderlyingObjectType = FileSystemObjectType.Folder,
- LeafName = docSetName
- });
- listItem["ContentTypeId"] = (object) contentType.Id.ToString();
- listItem["Title"] = (object) "Documents for account ";
- listItem["MSISDN"] = (object) mSISDN;
- listItem["Account_x0020_Number"] = (object) accountNumber;
- listItem["Hard_x0020_Copy_x0020_Location"] = (object) hardCopyLocation;
- listItem["Verified by"] = (object) verifiedBy;
- listItem["Date of verification"] = (object) veriDate;
- listItem.Update();
- clientContext.Load<List>(byTitle);
- clientContext.ExecuteQuery();
- }
-
-
-
-
- public void AddDocument(string siteUrl, string libName, string docListUrl, string docName, byte[] docStream, string mSISDN, string accountNumber, string hardCopyLocation, string documentName, string verifiedBy, DateTime veriDate)
- {
- ClientContext clientContext = new ClientContext(siteUrl);
- File file = clientContext.Web.Lists.GetByTitle(libName).RootFolder.Files.Add(new FileCreationInformation()
- {
- Content = docStream,
- Overwrite = false,
- Url = siteUrl + docListUrl + docName
- });
- file.ListItemAllFields["MSISDN"] = (object) mSISDN;
- file.ListItemAllFields["Account_x0020_Number"] = (object) accountNumber;
- file.ListItemAllFields["Hard_x0020_Copy_x0020_Location"] = (object) hardCopyLocation;
- file.ListItemAllFields["Document_x0020_Name"] = (object) documentName;
- file.ListItemAllFields["Verified by"] = (object) verifiedBy;
- file.ListItemAllFields["Date of Verification"] = (object) veriDate;
- file.ListItemAllFields.Update();
- clientContext.ExecuteQuery();
And I am calling them from another script C# script inside program.
- r.AddDocumentSet(XXX +
- Document.Field("Document Section 1\\Account").Value,
- Document.Field("Document Section 1\\MSISDN").Value.ToString(),
- Document.Field("Document Section 1\\Account").Value.ToString(),
- Document.Field("Document Section 1\\Hard Copy Location").Value.ToString(),
- Document.Field("Document Section 1\\Verified by").Value.ToString(),
- Document.Field("Document Section 1\\Date of Verifica00tion").Value.ToString());
- Processing.ReportMessage("Document Set created. ");
- }catch(System.Exception e){
- Processing.ReportMessage("Document Set already exists. ");
- }
-
- r1.AddDocument(XXX +Document.Field("Document Section 1\\Account").Value+"/",
- "contract_"+
- Document.Field("Document Section 1\\Account").Value + "(" +
- Document.Field("Document Section 1\\MSISDN").Value + ").pdf", bytes
- , Document.Field("Document Section 1\\MSISDN").Value.ToString()
- , Document.Field("Document Section 1\\Account").Value.ToString()
- , Document.Field("Document Section 1\\Hard Copy Location").Value.ToString()
- , Document.Field("Document Section 1\\Document Name").Value.ToString()
- , Document.Field("Document Section 1\\Verified by").Value.ToString()
- , Document.Field("Document Section 1\\Date of Verifica00tion").Value.ToString());
-
-
- }
And I get these errors:
No overload for method 'AddDocumentSet' takes '8' arguments (line 6, pos 1) No overload for method 'AddDocument' takes '11' arguments (line 69, pos 1)
I am not a C# rockstar but I have tried everything. rebuilt dll, rewriten the snippets again, but nothing helped. I hope someone could show me the right code.