Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

How to migrate data from list1 to another through Code{Either web part button or Window form application} (Logiical Help Needed)

$
0
0

Hello Friends,

Please can you help me in this logic

I have 2 lists

MYSkills

PS Numbers  Primary Skills  Secondary Skills Mobile

MYCv

PS Numbers  Attachment

We have 3000 entries in myskill list and 6000 entries in my cv list

I am planning not to use skill list rather i will add 2 columns in MyCv list Primary Skills and Secondary Skills

So i need to update previous entries in mycv list whose psnumbers are present in myskill list

 for the same i am planning to write a web part button

 on click of tht it will read psnumber  from the my skill list and will check in my cv list if present then will update newly added columns with myskills primary and secondary columns

if no ps number match then out of loop.

please help logically as i know how to read list of sharepoint in web part..and iterate..

one more thing i want to know how to do same thing in winform application

web part sample code-

string fieldValue1=null;
                SPList list1 = SPContext.Current.Web.Lists["CVCleanUP"];
                SPListItemCollection oListCollection1 = list1.Items;
                ArrayList arrayList1 = new ArrayList();
                foreach (SPListItem item1 in oListCollection1)
                {
                    fieldValue1 = Convert.ToString(item1["PSNO"]);
                    arrayList1.Add(fieldValue1);
                    SPList list = SPContext.Current.Web.Lists["My CV"];
                    SPQuery query = new SPQuery();
                    query.Query = string.Format("<Where><Eq><FieldRef Name='PS_x0020_Number' /><Value Type='Text'>" + fieldValue1 + "</Value></Eq></Where>");
                    SPListItem item = list.GetItems(query)[0];
                    //if read excel then use below code comment matching to above
                        //SPList list = SPContext.Current.Web.Lists["My CV"];
                        //SPQuery query = new SPQuery();
                        //query.Query = string.Format("<Where><Eq><FieldRef Name='PS_x0020_Number' /><Value Type='Text'>" + email + "</Value></Eq></Where>");
                        //Exception handling for psnumber if the excel psnumber not present in move list  
                        //try
                        //{
                        //    SPListItem item = list.GetItems(query)[0];
                            foreach (string attachment in item.Attachments)


sudhanshu sharma Do good and cast it into river :)



Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>