Avatar of Peter Chan
Peter ChanFlag for Hong Kong

asked on 

Way to do the upload

Hi,
Within Sharepoint 3.0 Central Admin, I need the way like this:
1. there can be new text files uploaded to Document library
2. Once there is a new text file uploaded in (1), we will create the relevant record in Custom list

How can we create such process? Can we do this by a C# project?
Microsoft SharePointC#Programming

Avatar of undefined
Last Comment
Arnold Layne
Avatar of SvenIA
SvenIA
Flag of Netherlands image

Hi,

I think it can be done using workflows. What kind of list entry must be created?
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Thanks. Can I have more details for the way of workflows? List does refer to Custom list.
Avatar of SvenIA
SvenIA
Flag of Netherlands image

When a file is uploaded to a specific document library, you want to add a list entry to a custom list?

It's hard for me to tell you what workflow you should create, ass i do not know specificly what you want.

http://www.codeproject.com/Articles/35404/8-Steps-to-Create-Workflows-using-SharePoint-Desig
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

You want to use the free SharePoint Designer tool for this. It's fairly easy. Here's how to use the tool. it's worth taking the time to understand this because you will use this tool over and over again.

http://sharepoint-videos.com/sp10creating-a-workflow-on-a-list-using-sharepoint-designer-2010/

Here is more specifically what you want to do after you understand the tool above.

http://sharepoint.stackexchange.com/questions/50059/create-a-list-item-when-item-is-created-in-another-list
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Thanks all. I've created one project
http://dl.dropbox.com/u/40211031/WSPBuilderProject1.zip

per what I've mentioned originally.

But I am getting these when building it.
Error    1    The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)    c:\proj\WSPBuilderProject1\WSPBuilderProject1\FeatureCode\SampleEventReceiver.cs    4    17    WSPBuilderProject1
Error    2    The type or namespace name 'SPListEventReceiver' could not be found (are you missing a using directive or an assembly reference?)    c:\proj\WSPBuilderProject1\WSPBuilderProject1\FeatureCode\SampleEventReceiver.cs    8    40    WSPBuilderProject1
Error    3    The type or namespace name 'SPListEventProperties' could not be found (are you missing a using directive or an assembly reference?)    c:\proj\WSPBuilderProject1\WSPBuilderProject1\FeatureCode\SampleEventReceiver.cs    10    41    WSPBuilderProject1

How to resolve it?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

I'm surprised you are doing this with event receiver code. As I said, doing this as a workflow in SharePoint Designer is much easier than writing event code and you wouldn't have to deal with errors like this. But to each his own and maybe event code is easier for you.

What are your references in solution explorer and what are your using statements at the top of your file? Also, if I remember correctly, you have to add an entry of your namespace to the GAC, but i think Visual Studio should automatically do that for you.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Thanks. If workflow is the better way, can I have the clear steps to set up all things necessary for it? I don't see a very clear procedure in this
http://sharepoint-videos.com/create-a-powerful-sharepoint-designer-workflow-part-1/
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

OK, open up Sp Designer and connect to the site (or subsite) that you are interested in via it's url. Then select the list you are interested in. Then, in the lower right, you'll see a section for workflows. Select new and you will see the non code workflow builder. If you let them write the code underneath the workflow builder, you won't have any errors, and you're just pressing buttons now. Sound good so far?

So click in the first step that you see and then choose condition in the ribbon above. Select "when any value equals any value, and then you will see two clickable links for the values to be set. For the first value, select the "modified" column, then select is not equal to, and then for the second value, click the browse button where you can enter a value and select "today". This is to check if it's a new entry or an edit because we don't want edits to write values to the other list. So if it's talking about the current record that was just added as a new one, then it's modified date will be empty, and if someone edits this, it's modified date will show as today and therefore no action should be taken in that case. Maybe you have even a better logic for this, but it was the first way I thought of doing this Then, click under the condition statement and select "action" in the ribbon above. Select "create list item" and you will see a link that says "this list". Click on it and you will see the dialog to set your actions up. The top field will say "list", and you select the list you want to add an item to when a new item is created in the source list. This will be a different list than you are creating your workflow for. Then, in the next box below, select the columns of the receiving list that will have values from the source list added to it. I think it goes without saying that you need to make sure data added from any of the source columns has to match the fields that it is entering data into in the new item in the other list. The column titles don't necessarily have to match but the column types do.  So add the fields of the recipient list that you want data to be added to, then click on each field and select modify. Here, you will set the actual value that will be sent to the recipient list column, by selecting the value in the same column from the sending list where the workflow is attached to. So for data source, select current item and for field from source, select the field from current item that matches that field from the recipient that you clicked earlier which launched these additional dialogs these additional dialogs. At the end, in the create new list item dialog, you should see the list columns that will be written to on the left, and the columns where the values will come from on the right. Make sure these match up and then click OK. Then make sure you set your workflow to start automatically and immediately. Then select publish from the ribbon above. That's it. Note that this workflow doesn't kick off until somebody does something in the list, and it kicks off every time somebody does something on the list, which is why we have our check to see if it's a new item, or an existing one that has been modified, because in each case, the workflow will execute, but if it's modified date is equal to today, then the conditional in the workflow prevents any further action in that particular case. And workflows can be activated or deactivated with the press of a button. If you get familiar with this tool, you can literally create something like this in under a minute.  You may have to play around with it, but you seem like a smart guy that will pick it up right away.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Thanks a lot. What is SP designer?
Avatar of SvenIA
SvenIA
Flag of Netherlands image

@HuaMinChen

SP Designer = SharePoint Designer

It's basically a website editor like Adobe Dreamweaver, but it's specifically designed to work with Microsoft Sharepoint. It has lots of features for Sharepoint, like the ability to create workflows.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Hi,
Thanks a lot.
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

SharePoint Designer is a FREE, website editor specifically geared for SharePoint, where it provides much more SharePoint related stuff than standard web editors. Download it and then, try to look back over my instructions. Hopefully, I made them very detailed and you will find out how easy this can be.

http://www.microsoft.com/en-us/download/details.aspx?id=35491
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Thanks a lot. After I've created/deployed the project, I see the wsp file has been created. How can I execute it, within Win 2003 server?

I did set up
mu_office_sharepoint_server_2007_sp3_x86_dvd

on the server. Why can't I see the relevant option to run wsp file?
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Furthermore, by this setup, why can't I have sp designer after the installation? If I try to run this for setting up sp designer within the server

en_office_sharepoint_designer_2007_service_pack_1_x86.exe

I've got the attached screenshot. Why?
t329.png
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Dear all,
Any help to this?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

It looks like you tried you install the service pack before you installed SharePoint Designer. It's telling you there is no version of SharePoint Designer installed on your machine for the service pack to act on, so somehow you downloaded the wrong thing.

As far as deploying your wsp into SharePoint, here's how.

For MOSS 2007
http://msdn.microsoft.com/en-us/magazine/cc163379.aspx

For SharePoint 2010
http://technet.microsoft.com/en-us/library/cc262995%28v=office.14%29.aspx

If you did this using workflows in SharePoint Designer, you wouldn't even need to deal with having to create a wsp and deploy it. If you ever get SharePoint Designer installed correctly and use it's workflow builder following the instructions I gave above, and you finally see how easy it is, you will regret doing the all of the extra work you had to do using wsp way. Like I said, if you understand SharePoint Designer's workflow builder, you can literally create this in a minute or two. You don't have to set up a project in Visual Studio, and you don't have to deploy it, you just select a few things in the workflow builder and hit the publish button.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Many thanks Bob.

My question is:
after the setup of "mu_office_sharepoint_server_2007_sp3_x86_dvd", why don't I have any Program group like "Microsoft SharePoint 2007 Products" in the server?

Further, I've created this command file
http://dl.dropbox.com/u/40211031/runwsp.cmd

to call this wsp project
http://dl.dropbox.com/u/40211031/WSPBuilderProject1.zip

but nothing happens when I run the command file. In the project, I call writeline through Console but nothing does happen. Why?
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Dear all,
Any help to this?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Hua, you don't have that SharePoint group because you never installed SharePoint Designer, and you are trying to install a service pack when you think it's the software itself. That file name that you are referencing looks like it's a service pack which requires an existing instance of SharePoint Designer already being installed because it even has sp3 (for service pack 3) in it's name. I can't assume you know what a service pack is based on your confusion. That file is NOT the correct file for installing SharePoint Designer, it is a file that you run on SharePoint Designer after it has been installed. You have not yet installed SharePoint Designer. The link I gave you was not to the service pack 3 file, it was to SharePoint Designer 2013, so I have no idea where you got that file from. Either use the link I gave you in a post above for SP Designer 2013, or use these if you want 2010, doesn't make a ton of difference either way.

Check whether your operating system is 32 bit or 64 bit

for 64 bit
http://www.microsoft.com/en-us/download/details.aspx?id=24309

for 32 bit
http://www.microsoft.com/en-us/download/details.aspx?id=16573

About your command for immediately deploying your solution, If you have SharePoint 2010 then if you try using this when the administrative Job is running, then it will simply skip the execution, so maybe this is why there is no error message. Maybe try removing the -immediate parameter and see what happens if you let it take it's turn based on it's place in line rather than forcing it. It's a shame because I can't show you that you don't even need to deal with creating a solution or it's deployment at all to solve your problem. You are using a cannon to kill a fly.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Thanks a lot. Regarding the current project, I have removed "-immediate" in the below command
http://dl.dropbox.com/u/40211031/runwsp.cmd

and then have run it inside the relevant folder but then I've seen nothing happened. But actually if you see the relevant project, it is inside to call writeline through Console.

Why do I get nothing by this?
C:\proj\WSPBuilderProject1\WSPBuilderProject1>dir *.wsp
 Volume in drive C has no label.
 Volume Serial Number is EC31-5D2C

 Directory of C:\proj\WSPBuilderProject1\WSPBuilderProject1

02/14/2013  05:57 PM            14,349 WSPBuilderProject1.wsp
               1 File(s)         14,349 bytes
               0 Dir(s)   2,136,162,304 bytes free

C:\proj\WSPBuilderProject1\WSPBuilderProject1>@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe" %STSADM% -o addsolution -filename OfficeSpaceFeature.wsp %STSADM% -o deploysolution -name WSPBuilderProject1.wsp - allowGacDeployment %STSADM% -o execadmsvcjobs


What others should I check further regarding the wsp file?

Bob,
Your details for using Workflow posted on 2-14 last week is not so easy to follow. Could you please show the steps one by one again clearly?

And regarding the steps you put for the way of Workflow on Feb-14, once I've clicked 'New', I do not see any wizard comes out but one new htm file shown on the attached screenshot.
t336.png
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Hi Hua, I apologize because I have made an error above. I thought the file you were referencing was a service pack for SP Designer and didn't realize that this was an install file for SharePoint itself. So assuming you actually have SharePoint Designer installed now, and you can see that SharePoint folder group under program files like you were looking for, then please refer to my instructions given before and let me know when you get stuck on something. It looks like you are stuck on the first step. You don't want to create an html or aspx page, you want to navigate to the list you are interested in in the Designer, and when you click on that list in the left nav, you will see all sorts of things you can do with that list on the right. You want to look at the bottom right in the workflows section and select new workflow, then the visual workflow builder launches, so after you see this, refer back to my instructions and let me know where you get stuck. I can't think of any better way to rewrite what I wrote unless I know which parts you don't understand.

About your other problem, what do you see when you run this command manually in stsadm? Does it just appear to do something for a few moments and then returns without any success message or any error message? I've had this happen to me before and i don't know exactly why, but it happened when I performed an upgrade and didn't run psconfig.exe from the prompt with the correct parameters. I saw problems in the central admin health monitor, and fixed those (including running psconfig), and the problem magically went away.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Good day Bob,
Many thanks.
It is really hard to follow the steps you shared on 02-14. Could you please advise what I should do in the attached screenshot step by step? I really need some clear steps/demonstration for the ways to choose the relevant uploaded flat files inside Document library, using sp Designer.

For 2nd question using a wsp project, I don't run psconfig.exe in the following command.
@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe" %STSADM% -o addsolution -filename OfficeSpaceFeature.wsp %STSADM% -o deploysolution -name WSPBuilderProject1.wsp - allowGacDeployment %STSADM% -o execadmsvcjobs

Which should I apply the upgrade to? Sharepoint designer or what?
Did you take a look at my project? What should be properly shown to this command with the project I tried? What should I adjust to the command?
t338.png
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

I know you don't run psconfig in your solution deployment command. This is something that runs the SharePoint Configuration wizard, and it has to be re-run after upgrades. so you don't run this in a deployment command. You didn't answer my question above. When you manually run this command by literally typing it into the command prompt, what happens? Do you see a success or error message or does it just hang for a couple of seconds and return to the prompt with no message? I can't help unless you answer the questions I ask.

As far as SharePoint Designer, somehow you skipped the very first step I told you to do. You have to open your site. Go to file, sites, then open site on the right pane, and type in the url of your site.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

When I run the command, there is no success or error message. It just finishes without giving anything.

For sp Designer, sorry for that I have no ideas what url it should be.
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

OK, as far as the command line stuff, that is exactly what happened to me. But it was happening because I did an upgrade to service pack one. Everything seemed ok, but I was getting strange errors when deploying and doing other things. I found out that after the full upgrade, you have to manually run psconfig from the command prompt with the right parameters. I ran this and all the little odd problems went away. I'm not sure if that's your situation, but it's the same exact behavior I had where it hangs for a few seconds and returns to the prompt with no message at all.

For sp designer, go to the homepage of your sharepoint site. Copy the url. Go into SP Designer and paste this address into the url field in the open site dialog and then click open.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Many thanks Bob.
For the command line, how can I adjust my command with "psconfig"? Could you please show the full command line I should use? Are you sure such way can be working?

For the url to use in sp Designer, I really have no ideas about it. Is it the relevant url which I get to access Sharepoint Central Administration?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

This is the PSConfig reference
http://technet.microsoft.com/en-us/library/cc263093%28v=office.14%29.aspx

This is the article pertaining to the problem i was having. I'm not sure it will fix the problem, it just did in my particular situation where the behavior of the deployment from the command line was the same. But you might not have Service Pack 1 yet.

http://social.technet.microsoft.com/Forums/en-US/smallbusinessserver/thread/94c5f178-f020-4d0f-ba7c-11c415d0d862/

As far as asking what address to enter in to open a site in SharePoint Designer, it's the address of your SharePoint site, not your Central Admin site. It's either http://yourdomainname.com or it's http://SharePointServerMachineName, depending upon how you have your alternate access settings set up in Central Admin. Copy and paste the location you see in the location bar when you are at the home page of your regular site, not Central Admin. Do you mean to tell me you have never even been on your regular site? That seems almost impossible and bizarre.

It's a shame that you are having such problems because I wanted to show you how much easier and faster this is than a Visual Studio Solution deployment. You don't have to write any code and it automatically handles all deployment issues for you and even validates the code you build in the visual code builder. But I'm wondering whether you're ever going to see it or even understand my explanation if you are having such a difficult time merely opening the site itself. That's the easiest part and I don't know why you're finding such difficulty with that. If that wasn't immediately intuitive to you, even after I told you how to do this, and I had to explain again, then I don't know how you're going to understand the rest of my instructions. I don't have any idea how you accomplished managing to learn how to deploy a solution like you seem to have, but you can't figure out what SharePoint site to open in SharePoint Designer. That's kind of amazing. I am completely perplexed and chuckling in amazement and shaking my head.

This comes back to your solution deployment attempt. Where do you even think you're  attempting to deploy your wsp to and how can someone manage to create a solution deployment with no knowledge of where it's actually being deployed to?
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Dear Bob,
I think there was a misunderstanding to me. I was confused previously which url I should try according to your steps.

I did yesterday set up Sharepoint server 2007 on this Win 2003 server and right here I can access the url, that is
http://ws03_office07:13043/

According to your steps posted on 14-Feb, after I've opened sp Designer and have connected to the site, do you mean which list I should further choose?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Here's the first two sentences of my detailed instructions above

"OK, open up Sp Designer and connect to the site (or subsite) that you are interested in via it's url. Then select the list you are interested in"

This meant that after you open the site, look at the nav on the left, and navigate to the list where you want the workflow created for. This is the list where you want an upload event to add a new entry to the custom list you created. When you get to that list, in the main pane you will see of the the list's properties, at the bottom right, you'll see a section for workflows. Click new and it will launch the visual workflow builder. I can't understand why you are obviously smart enough and knowledgeable enough to write C# code and deploy solutions, but you have such a hard time with simply opening up the list you want in SP Designer.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Good day Bob,
In Fig 1, there are files inside "email2list_attach" which is one Document library.

In fig 2, within "invoiceindex" that is a List, you see I have defined different fields/columns.

What I need is to capture one file within Document library and then append the contents of it, line by line, to the columns of a List.

For this from you
This meant that after you open the site, look at the nav on the left, and navigate to the list where you want the workflow created for.

can you please show also by a screenshot, which list I should navigate to?
fig1.png
fig2.png
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

I have no idea in the world where you got the idea from to add lists to Central Admin. But you are concerned with lists you create on the regular site (fig 2). Go to the homepage of your regular site, copy and past the url and use it to open the site in SP Designer. Then, navigate on the left and select lists and you will see your list by name, so click on your list name.

As far as what you want to do to a doc, oh boy, this just keeps getting worse and worse. A document is stored in the content database and the database returns a file stream when the doc is called for in SP. I don't know where you're getting your idea from that you can take a file stream and separate it's contents out into columns unless you are talking about an excel spread sheet.

Would you mind telling me what purpose that you think this will serve you? I've never heard of anything like this and there seems to be something wrong with the idea right from the start. So please tell me why you want to do this, not what you want to do. Maybe you should stop running around guessing and pressing buttons, and explain exactly, in detail, what problem you would like to solve, and then we can decide better how to solve it. You might be talking the entirely wrong approach to accomplish what you want but I can't tell you that until you explain why you want to do these things and what benefit you hope to acheive by doing it the way you are thinking of.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

The purpose to do that is to keep history of the data within the List for the uploaded file to Document library. Are you sure this is infeasible to achieve by whatever ways of Sharepoint?

To this:
Go to the homepage of your regular site, copy and past the url and use it to open the site in SP Designer. Then, navigate on the left and select lists and you will see your list by name, so click on your list name.

can you please show one screenshot as an example?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Do you want to save the past versions of the document when someone changes the doc and creates a new version?
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

The data transfer for input file in Document library to the List, happens only when one input file has been uploaded. So any newly uploaded file will be transferred to the List, if such way is possible to achieve. Many thanks.
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

So when someone uploads a doc to a library, do you want it to be copied and added to a different document library automatically as well?
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

That is not a problem, and please leave it. We only care the data transfer would happen when one input file has been uploaded into one specific Document library, like the example shown above few hours ago.
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

So when the upload takes place, you want your code to automatically open that document by accessing it via a file stream object, and then you append to it, and then save it back to the library. And, every time a new file is uploaded, you want the same thing appended to it. Correct? If so, why do you want to change the doc contents itself, rather than info in any meta data columns you can create for the doc library?
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Do you see Fig 2 that is for a List, above? I want the data to be transferred to the specific list. Supposing that, in the input file, one line is for one column. So the transfer is like: each line of the file -> one column in the list.

And there is no change to the input file at all but to read it.
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

If you are talking about parsing the doc where you take each line and put it into a column in a list, then I suppose this could be done. You would need to write code for the item added event, that creates a file stream to the doc, opens the file, parses it line by line via a for loop and adds it to the appropriate column. But I'll tell you one thing, this sounds like a really misguided idea because it contradicts basic and core information management theories. How can you know how many lines the doc will have? If you don't, now you have to create columns dynamically based on how many lines it finds because there always has to be enough columns for each line in the doc. How can you know which line should have a relational meaning with each column? So something sounds radically wrong about the whole idea itself according to everything that I understand about information management theory. This is why MS doesn't offer this capability, because lines in a doc are not considered data, The entire doc is one big piece of binary data, in one field, in one record.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Suppose that within one specific Document library, there are only files in specific formats uploaded to it. Definitely, I know you're talking about data validation, which can also be considered in that process we're struggling to have. Is this possible to achieve? If yes, how about the details to point to relevant Document library and List by C# codes?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Do you mean that every single doc is going to be required to have exactly the same amount of lines? Now you need an approval workflow to assure that this is the case, or somehow manage a back and forth rejection/approval process before the doc can be added. But do you know the best way to make sure that people only submit 8 lines and no more or no less? Have them fill out a form rather than type lines in a doc. That's what forms are for. You are using a doc for people to add info, when you actually need a form.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Why only 8 lines in the file? Can I have more lines like the example of Fig 2 above? Can I have the details to do this using an approval workflow? You can just suppose there are text files uploaded to the Document library from time to time and this is for sure to happen (don't worry about this please).
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

OK. so before I can recommend what to do, there's still some things I don't know.

What exact pieces of info are you looking for from the doc, and why do you need to display each piece in a column? So far, you haven't explained your purpose for wanting to do this and this information will effect the solution.. For example, do you want to grab sentences? if so, how do you decide which ones?  You either look for and get a pattern of characters through a regular expression, or if you want a whole sentence, you look for an ending period and space before you grab the value and enter it into the appropriate column while also having to decide which column it goes into. So now, you have to manually check all of those things and more about the doc before it can even be allowed to be added. So let's imagine you want to parse by sentence and you look for a period followed by a space, to denote the end of the sentence. Suppose someone accidentally doesn't put a space after the period? What happens then? Suppose the person manually reviewing the doc for approval doesn't see it?? What are you going to tell that person? Work harder? See better? Be perfect? It kind of defeats the purpose of using the computer at all. And, that mistake could exist forever unless you manually notice it after it's been added because the add won't fail, so you won't know there's been an error.

See how bad of an idea this is? That's why you don't do this, you use a form with validation. I don't mind trying to help you, but if I owned a SharePoint company and you insisted upon a solution like this, i would fire you and the people who insist that you do things the wrong way like this because it shows absolutely no understanding of information management theory at all and if someone doesn't have that, they shouldn't be deciding what the solution is because if they do, it's a disaster waiting to happen.
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Hi Hua, the more i think about it, the more I think it's impossible to do what you want. A human can enter in anything they want in a doc. There's no controlling that like you can with a form. So other than them always, 100% entering in the exact correct stuff in the exact order needed, you can't control what is entered unless you account for every single possible thing that someone can add to a doc, which is almost impossible, and maybe it is impossible, and that's why forms are used for these purposes and docs cannot be used. This is why MS correctly does not give you this capability out of the box, because the desire itself for this capability is flawed and carrying it out is an accident just waiting to happen and many headaches manually correcting things, but the really disastrous and unacceptable part is that you won't even be aware of the errors to correct them unless you see them manually. Even your reviewer cannot be counted on to be perfect, so in the computer world, this is a very wrong approach and a disaster waiting to happen.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Hi,
Thanks. I want to know if that can be achievable or not. Data validation is something like a further enhancement to the process depending on that it is achievable!
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

So you want me to give you enough rope to hang yourself. Sure, but unless I know what you actually want to do, and why you want to do it, I can't build the right noose for you.

1) How will users enter things into these docs? Do they just type the things that you recommend they type or is there some sort of ordered system they have to enter stuff?

2) What is it we are going to be looking for from these docs after we open them in a FileStream object? Just saying "lines" is a meaningless statement. Will there be a table of contents on these docs that might be accessible via code and provide a reference point in the doc? You need some way for the doc to be marked in certain key areas as a reference point, so that your code can come by and find these areas in the doc if it is aware that the doc has these markings (tags) within it

3) How do you want to decide which part of the doc goes into which column?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

"Hi,
Thanks. I want to know if that can be achievable or not. Data validation is something like a further enhancement to the process depending on that it is achievable! "

This is called "painting yourself into a corner". The ability to validate gets checked before the idea even goes any further, so you are doing this in the exact backwards order. What's the point of collecting data at all only to later find out it can never be validated properly???? Why even move on with issues of collecting data that can never be properly validated? Who is telling you to think about things the way you are?

Invalid data is even worse than no data because now the person is mislead by the data and given a false sense of knowledge, which is the worst possible thing that can happen. You are better off showing no data at all than showing data that has even the slightest chance of being flawed.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

How about that we also validate the data within the process we're going to develop? Can you please provide the details of the way to me, if you have?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

No I can't because I don't think this can ever be validated properly in any meaningful way, which is why I asked you those questions and you didn't answer them. Here's how to deal with extracting text from a word doc. I have no idea what text you want from the doc, how you want to decide that.....so all I can do is give you the link below and you figure of what you want from there, because you won't tell me specifically. Like I said, getting "lines" from a word doc is a meaningless statement that tells me absolutely nothing. Answer number 4 in this link tells you how to extract text from a word doc. After that, you're on your own.

http://stackoverflow.com/questions/1011234/how-to-extract-text-from-ms-office-documents-in-c-sharp
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

I never said the file is a document. It is just a text file.
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Right, you never said much of anything in general to describe what the situation is.

http://techolyvia.wordpress.com/tag/read-content-of-text-file-from-sharepoint-document-library/
Avatar of SvenIA
SvenIA
Flag of Netherlands image

Can someone tell me how to exit this conversation. My mailbox is overloaded with crap!
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

my monitored questions on the right, then more.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Hi Bob,
Please see the attached figure again, inside which I've defined the List inside Sharepoint central admin.

you see I have defined different fields/columns in it.

I have these codes
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
//using System.Web.UI;
//using System.Web.UI.WebControls;
//using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

namespace WSPBuilderProject1.FeatureCode
{
    public class SampleEventReceiver : SPListEventReceiver
    {
        public override void FieldAdded(SPListEventProperties properties)
        {
            string contents = string.Empty;
            using (SPSite site = new SPSite(@"http://WS03_Office07:33051"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists["invoiceindex"];
                    SPListItem newItem = list.Items.Add();
                    newItem["Title"] = "Testing";
                    newItem.Update();
                }
            }
        }
    }
}

in this project.
http://dl.dropbox.com/u/40211031/WSPBuilderProject1.zip

But when I run the project by the below command
@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe" %STSADM% -o addsolution -filename WSPBuilderProject1.wsp %STSADM% -o deploysolution -name WSPBuilderProject1.wsp - allowGacDeployment %STSADM% -o execadmsvcjobs

within folder
C:\proj\WSPBuilderProject1\WSPBuilderProject1\

I see nothing happens!
fig2.png
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

I think the @ is only used when you are adding html tags in the string and it escapes them. But you have no html, it's just a url, so get rid of the @

This example:
using (SPSite oSiteCollection = new SPSite("http://Server_Name/sites/Site_Name/Subsite_Name/default.aspx"))
{
    ...
}

From here
http://msdn.microsoft.com/en-us/library/ms466911.aspx

Does not use @

neither does this example from the link

using (SPSite oSiteCollection = new SPSite("http://" + System.Environment.MachineName + "/sites/Site_Name"))
{
    ...
So i don't know how any of this even works at all or compiles. If you could tell me what you really want to achieve as an end goal, rather than giving me little snippets that are unexplained from a larger level, then there's really not much I can do to help you because after all these posts, I still don't know what you want to achieve as the final end result. All you have said is that you want to get lines from a document and put them into columns, and then, at least you qualified that it was a text file not a document. But that's all I know and the statement of getting lines from a document is a completely meaningless statement, and you refuse to give further details.. So why should I bother? If you want to keep the larger objective hidden, then it's your problem to solve. I can't do anything else. I'm not going to continually try to solve every mess you create for yourself if you refuse to say what you really want to do and then do it the way you should do it. You did at least mention you are creating your lists in Central Admin, and this is, of course, the entirely wrong place to put SharePoint lists. So if for some reason you think that SharePoint lists belong on Central Admin rather than the regular site, then you are completely lost, and perhaps you should have read a lot more upfront before you bothered jumping into SharePoint. I'm not trying to be critical, but if you don't even understand the difference between your admin site and your regular one, and what the purpose is for each one, then you honestly shouldn't be touching SharePoint, no matter how much C# code you think you can figure out.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Hi Bob,
I've removed @ within the codes in the project. I then redeployed and reran the project in the server, but I still see nothing happens when running the project.

For the way using Workflow, as I've demonsrated what I expect to change using the file in Document library, can you please show the clear steps (also show some screenshots) of the way to me?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

What information would you like from the text file? Do you want to search for a word and maybe even count how many times you find that word and enter that count into a column, and then keeping searching the file for other words and put those counts in other columns? Do you want to get the first x amount of sentences in the file? How can I tell you how to get something out of a file when you refuse to tell me what you want from it? I clearly told you that "lines in a document" means absolutely nothing to me, and instead of explaining further, you just keep insisting that you have already explained, when I have even told you that the explanation was meaningless and told you what I need. So how do you think I feel watching you just blatantly ignore half of the questions I ask, and then coming back and repeating your same question with no further clarification and asking for assistance?

As far as why your deployment is failing, it could be for any reason at this point as I really have no idea how you set your site up. You said you added your list to Central Admin, and I told you that if you even thought to do this, then you don't have any idea of the structure of SharePoint. Your last answer didn't explain anything about why you said you created this list in Central Admin and you acted as though I never raised this point. So I can't even assume that SharePoint has been installed and set up correctly. Normally, I would assume that it is, but if you think you are adding lists to central admin then I can't assume anything anymore.
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

add solution  "wsp"
stsadm -o addsolution -filename "path to filename.wsp"

add stsadm command to comit the changes
stsadm" -o execadmsvcjobs

Deploy solution to your sharepoint site
stsadm" -o deploysolution -name filename.wsp -url [URL site] -allowgacdeployment -immediate -force

I didn't see any url specified in your commands.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Hi,
The input text file is in this format

col 1 line
col 2 line
col 3 line
...

and each line is specifically for each column.

How to adjust my command to include the url as well?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

parse the file for CTRLF using a regular expression
As far as url, do you know what the root url of your sharepoint site is?

-url "http://yourdomain.com"
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

So if you have exactly 8 lines in every text file that is added, and you have exactly 8 columns to store the lines, then it will work. If some docs have 9 or ten lines, then either your code will break, or you will merely ignore that info that might be important, or you will have to account for any additional lines by creating additional columns dynamically in code. So there could be the possibility of 16 columns or technically speaking, any amount of columns that would have to be created dynamically.

I hope this is strictly a learning project because a real world one should not be done this way.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Hi,
Here is the link
http://ws03_office07:13043/default.aspx

by that I access Central Administration.

In the project, I also access the site by
http://WS03_Office07:13043

I have redeployed/rerun the project,
http://dl.dropbox.com/u/40211031/WSPBuilderProject1.zip

using the command, but I still have got nothing happens.

I do have the details in the input file, but you never support how to transfer the data into the List!
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

"Hi,
Here is the link
http://ws03_office07:13043/default.aspx

by that I access Central Administration."

In the project, I also access the site by
http://WS03_Office07:13043"


Those are both the same exact thing, default.aspx is the default document that shows up when you type in the url without specifying a particular page. Why are we talking about your Central Admin site instead of your regular site? That's where you deploy solutions. Have you ever even seen your regular site? What do you see when you go here http://WS03_Office07 

Doesn't your regular site come up? Do you understand the difference between the central admin site and the regular site and the purpose of each??

"I have redeployed/rerun the project,
http://dl.dropbox.com/u/40211031/WSPBuilderProject1.zip

using the command, but I still have got nothing happens."


Of course because you don't deploy solutions to central admin, you deploy them to your regular site. I had no idea that you knew so little about SharePoint and I just assumed that you knew what your regular site is, when in fact, now it appears as though you don't. You should not be touching SharePoint at all until at least you understand the difference between central admin and your regular site, and the differences in their purposes.


I do have the details in the input file, but you never support how to transfer the data into the List!

I'll look at the zip file
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

I looked at the zip file and you created event receiver code, but you never created a feature to hold the event code, it looks like you just created a folder to hold it. Now I have visual Studio 2010, and it did tell me it had to covert it, but if you see your event code underneath a regular folder rather than a feature, and you don't see a feature.xml file and one or more elements.xml file, then you can't deploy anything until you understand what features and solution packages really are. This project will never deploy in it's current state, and I would worry more about learning about features than I would worrying about specific parts of your code.

http://msdn.microsoft.com/en-us/library/bb466225%28v=office.12%29.aspx

As far as the actual code, here's how to read a text file

http://www.csharp-station.com/HowTo/ReadWriteTextFile.aspx

Here's how to add values to your list
http://msdn.microsoft.com/en-us/library/ms467435.aspx

You want to loop through looking for each line and how many times you want to loop,  or whether you use a while loop, that's up to you.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Thanks.
Please see the attached one,

inside the project, I have the feature.xml file. Do you have the tutorial/sample to handle with feature.xml and elements.xml files inside the project?
t362.png
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

What do you see when you go to http://WS03_Office07  with no port number specified?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

You have only one feature, so you really don't even need to create a wsp. So on your file system drive, go to 14\Templates\Features  or 12 if you have 2007.

1) Create a new folder inside of Features, preferably the same name as your project has so you know which project to open to edit that feature later on. This will be your feature name, so name the project and folder you add within the Features folder with something meaningful.

2) Review your feature.xml and make sure it points to your elements.xml file (or whatever you named your elements file), as being in the same folder, so you don't even have to add a path to it if it's going to end up in the same folder, which it will.

3) Make sure your elements file points to your event code file as being in the same folder as well because this is where you are going to put it.

4) Then in Features.xml, make sure you have a list name specified, so that this feature will be deployed to any list that has that name across the site collection.

5) Then, from your file system (not Visual Studio), copy Features.xml, your element file and your event code file into the new folder you created inside the Features folder.

6) Now you need to install it. You should add the path of your stsadm to your system or server's environment variables as a convenience for you so that you can use stsadm from any directory without having to specify it's full path as you are doing.

from stsadm, run the following commands from here

http://msdn.microsoft.com/en-us/library/ms442691%28v=office.12%29.aspx

You will notice this:

stsadm –o activatefeature –name < folder in FEATURES directory containing the Feature.xml file > -url http://Server/Site/Subsite

This might not work for you because you don't seem to know what url to even deploy this feature to and you keep talking about central administration, and you won't tell me what you see when you go to http://WS03_Office07 in your browser. So as far as the correct url to enter is concerned, that's now your problem, as I asked a few times what you are seeing when you go http://WS03_Office07 (no port number on the end), and you haven't told me. So i have no idea of your site set up and for all I know, it could be totally wrong.

Anyway, I can't explain this any more clearly than I did above. I would also recommend at least reading about the basics of SharePoint before you go in customizing things. Otherwise, you will be a train wreck waiting to happen, and you will know enough to break the site in multiple ways, but not know how to fix it.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Good day Bob,
I get this
 
Under Construction


The site you are trying to view does not currently have a default page. It may be in the process of being upgraded and configured.

Please try this site again later. If you still experience the problem, try contacting the Web site administrator.


--------------------------------------------------------------------------------

If you are the Web site administrator and feel you have received this message in error, please see "Enabling and Disabling Dynamic Content" in IIS Help.

To access IIS Help
Click Start, and then click Run.
In the Open text box, type inetmgr. IIS Manager appears.
From the Help menu, click Help Topics.
Click Internet Information Services.
 
when going to
http://WS03_Office07

Appreciated a lot to your continuous help. what details should be inside element.xml file? Can I have the details of the way to create that?

Any problem with my current eventreceiver.xml file, that is
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Receivers ListTemplateId="104">
            <Receiver>
                  <Name>SampleEventReceiver</Name>
                  <Type>FieldAdded</Type>
                  <SequenceNumber>10000</SequenceNumber>
                  <Assembly>ListEventReceiverSample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b76b58963356367a</Assembly>
                  <Class>ListEventReceiverSample.FeatureCode.SampleEventReceiver</Class>
                  <Data></Data>
            </Receiver>
      </Receivers>
</Elements>

Any problem with my current feature.xml file that is

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
 Id="{4F2F7A38-F708-41BB-A2FF-53FC57CB5BF5}"
 Title="Sample List Event Receiver"
 Description="This is a sample."
 Scope="Web">
      <ElementManifests>
            <ElementManifest Location="eventreceiver.xml"/>
      </ElementManifests>
</Feature>

If yes, how to adjust both?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Are you the server administrator? If you are not, you need to ask the server admin where the regular SharePoint site is. If you are the server admin, you have completely fouled the SharePoint installation up. I have no idea how that can happen, but somehow you managed to do that.

So before you do anything, take the time to read the basics of SharePoint instead of thinking every thing is so easy and you can just push your way through this. Then, after you have a reasonable understanding of it, uninstall SharePoint and reinstall it correctly.

This is why I kept asking about this issue over and over again, and you wouldn't answer me until now. I suspected something was wrong with the entire set up and if you are both the server admin and the site admin, then it is definitely the wrong set up because you don't even know that there are supposed to be two sites, one where all your info is stored and viewed, like the list that holds you text files, and then another site with a port number attached to the end of it's address, which is your central admin site, and that is used to administrate your regular site.

You don't put lists on your central admin site, you put them on your regular site. So I'm sorry, but you are completely lost, and you wouldn't be if you had just taken a little time to learn about SharePoint rather than thinking you can just dive right in. So your assumption is now costing you.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Hi,
Please see the attached file. I think it is the admin site.
t364.png
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Your entire set up is a complete mess and you probably shouldn't be messing around with SharePoint. That is your Central Administration site, and that is NOT where you deploy solutions to, you deploy them to the regular site, but you don't even understand that there is supposed to be a regular site, and therefore you've never even seen it and have no idea where it is, so you have zero basic knowledge of SharePoint and yet you are trying to deploy event code and solutions, which are the more complex things that one does in SharePoint.

On the page you attached, go to the left nav and select configuration wizards, and select "launch the farm configuration wizard".
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

How can I select configuration wizards on the left nav? Can you please show it by a screenshot as well?

How can I check whether the regular site does exist or not, within the current server?
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

I have SharePoint 2010, you have 2007 Enterprise, so screen caps are useless. Look under operations on central admin. If you don't find it there, keep looking. Look around a little bit for yourself because you need to understand central admin, and you have absolutely zero understanding of what it even is.

But this sounds like such a mess that I would even recommend uninstalling SharePoint and then reinstalling,. and this time follow the instructions properly, and then, after you install it, take a little time to read about and understand what you have installed.

http://www.codeproject.com/Articles/36206/Steps-required-to-install-Microsoft-Office-SharePo

You are asking people to teach you SharePoint from the bottom up. That requires a course, which is what you should take. But experts here are supposed to answer specific questions, not provide an entire SharePoint tutorial from the ground up when you can easily find this and read it for yourself. You don't want to do any of the up front work and learning, but that shouldn't mean that I should have to do that for you. You are starting to see that you can't just take the shortcuts that you seem to think you can, and you just keep ignoring that fact.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Do you think I can even try Sharepoint 2010 instead?
ASKER CERTIFIED SOLUTION
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
C#
C#

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

98K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo