Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-01-11
5
Medium Priority
?
532 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 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