?
Solved

Creating a SharePoint List item and new directories on network share from Visual Basic 2010

Posted on 2013-01-11
5
Medium Priority
?
529 Views
Last Modified: 2013-01-22
Hello Experts,

I am working on a small windows form application using Visual Basic 2010.
I am looking to accomplish 2 things. (FYI - #1, I got - I need some help with #2)

1. Create a program/windows form (with the following fields: FirstName, LastName, CustomerNumber, and a button to click labeled "create folders") for my employees to fill out that will create several empty folders on a windows network share.

Example:
Z:\Customers
Z:\CustomerName12345
Z:\CustomerName12345\Purchases
Z:\CustomerName12345\Returns
The purpose for doing this is to create some commonality for how my employees manage their folders on my network share.  Note: I do not want users to save files to share point.

I have already achieved this quite easily using My.Computer.FileSystem.CreateDirectory _
("Z:\" & CustomerName & CustomerNumber) and so on for the subdirectories.

2. I created a SharePoint List called "Customers" With 3 fields (FirstName, LastName, and Folder). I want the "Folder" column to be formatted as a hyperlink that links to the appropriate folder (and opens a windows explorer window to that location) which was just created at the same time when my employees click the "create folders" button.

I am not a strong VB programmer and am seeking example code to "create a sharepoint list item" to accomplish this task.

Please let me know if you can help.

Thanks
0
Comment
Question by:MikeXna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
colly92002 earned 2000 total points
ID: 38770449
0
 

Author Comment

by:MikeXna
ID: 38772662
Thanks.  This looks perfect.
Newbie Question: When I pasted the code into my project these first few lines have green underline:

Imports System
Imports Microsoft.SharePoint.Client
Imports SP = Microsoft.SharePoint.Client

When I mouse over them I get the following message:
"Namespace or type specified in the Imports Microsoft.SharePoint.Client doesn't contain any public Member or cannot be found. Make sure the namespace or type is defined and contains at least one public member"

I am sure i am missing something obvious. In visual basic, am I supposed to import any dlls into my solution explorer or something for the code to recognize?

Thanks
0
 
LVL 15

Expert Comment

by:colly92002
ID: 38772981
You are right you need to add the referenced .dlls to the project - if you started a new "Sharepoint" project in visual basic they will be there, but if not, just go to the  references box on the right hand side, right click add reference, and find the microsoft.Sharepoint.client.dll  (you might have to browse to the Sharepoint 14 hive to find it - if in doubt just google its path  because its in a standard directory).   As soon as you have added it it will work.
0
 

Author Comment

by:MikeXna
ID: 38790126
Got the dlls from MS download site after a google search.  The code now works,.
I was able to create a list item -- Thank You

2 Last questions.

1. Does the shareshpoint.client.dll need to be on every client/employee computer? When I build my project the exe in the debug folder works on my pc but not on a computer without the dlls.  Perhaps I am missing something obvious.  I never really published the project.

2. I was only able to create a list item but my text fields are not saving to sharepoint.  I am prompted with an error stating that the field on sharepoint does not exist.  I know it does... Perhaps It is a syntax thing in my code? Can strings be saved to sharepoint plain text fields?

Thanks again.
0
 
LVL 15

Expert Comment

by:colly92002
ID: 38792635
Yes you need the dll on each computer that this is going to run on - you can do this when you package up you project or you can just install the dll manually (I would learn how to build a deplyment package in visual studio personally - search for it in google there are lots of examples).

Sharepoint gives you horrendous error message - the "field does not exist" message just means that "something" is wrong.  It may be the syntax of the command or you maybe addressing your fields incorrectly.  Use the debugger to (put a breakpoint in the code and run the project) step through your code and see what line fails.  Always start by doing the simplest thing you can do and get that working, then build on it.  Sharepoint text fiedls will accept strings without complaint, just make sure there are no control characters in your string that might be confusing things, and that the size of your string is not bigger than your field definition.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question