Kanan Hasanli

Kanan Hasanli

  • NA
  • 1
  • 684

No overload for method ' ' takes 8/11 arguments

Feb 25 2016 8:43 AM

I have these two code snippets:

  1. public void AddDocumentSet(string siteUrl, string libName, string docSetName, string mSISDN, string accountNumber, string hardCopyLocation, string verifiedBy, DateTime veriDate)  
  2.         {  
  3.           ClientContext clientContext = new ClientContext(siteUrl);  
  4.           Web web = clientContext.Web;  
  5.           List byTitle = clientContext.Web.Lists.GetByTitle(libName);  
  6.           clientContext.Load<Site>(clientContext.Site);  
  7.           ContentTypeCollection contentTypes = byTitle.ContentTypes;  
  8.           clientContext.Load<ContentTypeCollection>(contentTypes, (Expression<Func<ContentTypeCollection, object>>) (types => ClientObjectQueryableExtension.Include<ContentType>(types, new Expression<Func<ContentType, object>>[]  
  9.           {  
  10.             (Expression<Func<ContentType, object>>) (type => type.Id),  
  11.             (Expression<Func<ContentType, object>>) (type => type.Name),  
  12.             (Expression<Func<ContentType, object>>) (type => type.Parent)  
  13.           })));  
  14.           IEnumerable<ContentType> source = clientContext.LoadQuery<ContentType>(Queryable.Where<ContentType>((IQueryable<ContentType>) contentTypes, (Expression<Func<ContentType, bool>>) (c => c.Name == "Earchive document")));  
  15.           clientContext.ExecuteQuery();  
  16.           ContentType contentType = Enumerable.FirstOrDefault<ContentType>(source);  
  17.           ListItem listItem = byTitle.AddItem(new ListItemCreationInformation()  
  18.           {  
  19.             UnderlyingObjectType = FileSystemObjectType.Folder,  
  20.             LeafName = docSetName  
  21.           });  
  22.           listItem["ContentTypeId"] = (object) contentType.Id.ToString();  
  23.           listItem["Title"] = (object"Documents for account ";  
  24.           listItem["MSISDN"] = (object) mSISDN;  
  25.           listItem["Account_x0020_Number"] = (object) accountNumber;  
  26.           listItem["Hard_x0020_Copy_x0020_Location"] = (object) hardCopyLocation;  
  27.           listItem["Verified by"] = (object) verifiedBy;  
  28.           listItem["Date of verification"] = (object) veriDate;  
  29.           listItem.Update();  
  30.           clientContext.Load<List>(byTitle);  
  31.           clientContext.ExecuteQuery();  
  32.         }   
  33.   
  34.   
  35.   
  36.   
  37. 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)  
  38.     {  
  39.       ClientContext clientContext = new ClientContext(siteUrl);  
  40.       File file = clientContext.Web.Lists.GetByTitle(libName).RootFolder.Files.Add(new FileCreationInformation()  
  41.       {  
  42.         Content = docStream,  
  43.         Overwrite = false,  
  44.         Url = siteUrl + docListUrl + docName  
  45.       });  
  46.       file.ListItemAllFields["MSISDN"] = (object) mSISDN;  
  47.       file.ListItemAllFields["Account_x0020_Number"] = (object) accountNumber;  
  48.       file.ListItemAllFields["Hard_x0020_Copy_x0020_Location"] = (object) hardCopyLocation;  
  49.       file.ListItemAllFields["Document_x0020_Name"] = (object) documentName;  
  50.       file.ListItemAllFields["Verified by"] = (object) verifiedBy;  
  51.       file.ListItemAllFields["Date of Verification"] = (object) veriDate;  
  52.       file.ListItemAllFields.Update();  
  53.       clientContext.ExecuteQuery();  
 
And I am calling them from another script C# script inside program.
  1. r.AddDocumentSet(XXX +   
  2. Document.Field("Document Section 1\\Account").Value,   
  3. Document.Field("Document Section 1\\MSISDN").Value.ToString(),   
  4. Document.Field("Document Section 1\\Account").Value.ToString(),   
  5. Document.Field("Document Section 1\\Hard Copy Location").Value.ToString(),  
  6. Document.Field("Document Section 1\\Verified by").Value.ToString(),  
  7. Document.Field("Document Section 1\\Date of Verifica00tion").Value.ToString());  
  8.             Processing.ReportMessage("Document Set created. ");  
  9. }catch(System.Exception e){  
  10. Processing.ReportMessage("Document Set already exists. ");  
  11. }  
  12.   

  13. r1.AddDocument(XXX +Document.Field("Document Section 1\\Account").Value+"/",  
  14.               "contract_"+  
  15.             Document.Field("Document Section 1\\Account").Value + "(" +   
  16.             Document.Field("Document Section 1\\MSISDN").Value + ").pdf", bytes  
  17.             , Document.Field("Document Section 1\\MSISDN").Value.ToString()  
  18.             , Document.Field("Document Section 1\\Account").Value.ToString()  
  19.             , Document.Field("Document Section 1\\Hard Copy Location").Value.ToString()  
  20.             , Document.Field("Document Section 1\\Document Name").Value.ToString()  
  21.             , Document.Field("Document Section 1\\Verified by").Value.ToString()  
  22.             , Document.Field("Document Section 1\\Date of Verifica00tion").Value.ToString());  
  23.   
  24.   
  25. }  

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.


Answers (1)