Skip to main content

Posts

Showing posts with the label c#

SharePoint 2013 CSOM Error : Custom Login Page (Forms Based / Mixed mode authentication)

If you have a SharePoint On Premise installation with a Custom Login Page , you might encounter issues working with CSOM. The error would be primarily related to Authentication Failure. The following solution worked for me. Step 1 : The Custom Login Page should be placed in IIS Virtual Directory. As a general practise the custom login page is normally placed in the 15 Hive Layouts folder. Move/Copy the ASPX file of your custom login page from the 15 hive layouts folder to  the following folder in IIS Virtual directory of the concerned Web Application: “C:inetpubwwwrootwssVirtualDirectories<yoursite>_forms” Step 2 : Edit the Custom Login page file to make sure the master page url is correct. After the movement of the ASPX file, open the file in a notepad and check for the  MasterPageFile  value and change it to the following  =”~/ _layouts / 15 / simple . master “. Step 3 : Change the Custom Login Page Url in Central Administration. Navigate to Central Admin and change the Url def

Simultaneously start multiple Sharepoint 2007 workflows using C# for a List

 Its known that we can start SharePoint 2007 workflows  programmatically .  Here is the code that loops through all items in a list and starts the workflow for each item: foreach(SPListItem item in list.Items) { SPListItem wrkItem =list.GetItemById(item.ID); wrkflowmgr.StartWorkflow(wrkItem,wflassociation, wflassociation.AssociationData); } However the SharePoint Paradox here is that you can start only one workflow at a time , and have to wait for it to take its sweet time to finish, before you start the workflow for next item in list.  So what do you do if you have ( like i had ) a requirement to start a workflow on multiple items in a list simultaneously ?  Obviously you post a question shouting for help in  stackoverflow . I was told: there is no  simultaneous  method to start workflows for multiple list items at the same time. But  i eventually figured out, that  Multi Threading is the solution. Steps Create a Class “startWorkflow” that starts the workflow for a l

FTP C# Error : “The remote server returned an error: (530) Not logged in ."

  Recently working on a FTP solution using C# , i encountered an error  “ The  remote server returned an error: (530) Not logged in.” The code i used was following: FtpWebRequest request = (FtpWebRequest)WebRequest.Create( ftp://xxxxxx/file.txt ); request.Method = WebRequestMethods.Ftp.UploadFile request.Credentials = new NetworkCredential(usernameVariable, passwordVariable); What was more bewildering was if i modified the code to following, the solution was working fine. But this for obvious reasons is not an option as the username cannot be hardcoded //works but implausible to use in realtime solutions request.Credentials = new NetworkCredential("dmn/#gsgs", password);  Some googling revealed that special charcters create issues in the NetworkCredential Object. Hence some playing around worked for me, and it works irrespective of wether i do a FTPWebRequest or WebRequest. Solution: Instantiate NetworkCredential object with three paramters (username, password, domain) and m