How to create a feature for uploading files - c#

I'm not really used to ask some questions. But it's gonna 4 days now, and I'm still stuck with this issue.
I would like to create a feature, using Visual Studio 2010, which allows me to upload and replace some files into a Sharepoint 2010 web site. Visual studio and C# are brand new for me, but with our good friend Google, I can handle it.
I can make a feature for changing the title of my website for example. But I don't really know how to do for uploading and replace some files (like a .css or a .js for example). I don't even know where to start and what I should looking for.
Do you guys have a clue to help me out?

Can you elaborate on what you exactly are trying to do? I can provide you with code to upload files within SharePoint, but if I see what files you are trying to upload I am wondering how you want to use them.
If you are trying to add css or js files to use them in your own webparts, you should add a mapped folder for "Layouts" and put those files in that folder. There are a lot of different possibilities with SharePoint, so maybe to start you should check out some hands on tutorials to create a feature, custom webparts, ... and a lot of your questions will be answered in those tutorials.
Good luck with it!

Related

How to filter out all .cs files inside a solution (.sln) file in c#

I am currently working on a project where i want to analyse someones code and then make a class diagram out of it. I am making this website with the .NET MVC Framework.
What i have so far is a form where the user can upload their .sln file. Now i have to figure out how to seperate the .cs files from the solution to analyse the classes and convert them to XML. I am still a beginner when it comes to C# and this framework in general. I would really appreciate if someone can give me some tips on how to do this in the most efficient way possible. I have read some things about Roslyn but im not sure if there are more efficient ways to accomplish this.

How to programmatically create custom comment tokens

I am writing a small Visual Studio addin to let the user use more features of the comment tokens (TODO, HACK, etc.). For this I want to extend Visual Studio with new commands (such as TODISCUSS, TODELETE, FIXME, TESTME, etc.). I'd like to do this programmatically when my addin starts.
I already found out how to do this manually: http://msdn.microsoft.com/en-us/library/ekwz6akh%28v=vs.80%29.aspx
Does anyone have an idea how this could be done via the API?
Any ideas or suggestions would be appreciated!
Edit :
See this MSDN Link perhaps digging around in TaskList will get you somewhere.
Original Post :
It's not very clear (to me :) what exactly you want to do. Is it: find, edit, or refactor the tokens and then do something else with the sources? I can suggest this article on Code Project (NRefactory).
Using NRefactory you can do anything and everything with the source files including locating the tokens you want and doing stuff with them. You will also know the files you found them in, line numbers etc.
Perhaps you will be able to use Nrefactory to do all the heavy lifting as far as sources are concerned.

Uploading a file from a C# desktop application to a PHP script?

I am looking to create a desktop application in C# which :
Allows the user to select a file / multiple files / folder containing files from his computer.
Upload the files selected to a PHP script (which is already equipped to handle file uploads using the $_FILES array.)
I'm a PHP developer and have never coded a single line of .NET before. So, you can assume I have no experience with .NET whatsoever.
I have looked this up online and all I seem to come up with are ASP.NET server side upload controls which i do not want. I'm looking for a client side solution. Also, will i have to make any changes in my PHP script ? The script already handles uploads from an HTML multipart form.
If anyone can help me point in the right direction of where to look, what C# controls are available which can help me create the application I need, I would really appreciate it.
The first, and simplest, way to go about this is to use any of the WebClient's UploadFile methods.
Here's some info an an example;
http://msdn.microsoft.com/en-us/library/36s52zhs.aspx
I have a feeling that this will not be enough for you, since you want to upload multiple files in a single request. The WebClient class can be used to manually build a http multipart request, which is probably your best bet.
It's a bit much to explain how to achieve this here on SO, but there are good guides out there.
Here are a couple of very to-the-point articles
http://www.codeproject.com/KB/cs/uploadfileex.aspx
http://www.codeproject.com/KB/IP/multipart_request_C_.aspx
And if you're interested in the details, or better OO design, here's an alternative (a bit harder to follow if you're not experienced with C#)
http://ferozedaud.blogspot.com/2010/03/multipart-form-upload-helper.html
I think both articles should give you enough info to get started.

printing every page of a VSTO project

I'm using visual studio and I'd like to have a paper copy of my project. There are c# libraries, aspx files, javascript files, css... I'd like to print everything at once to my pdf printer. I know I can do this one file at a time but I was wondering if there is a magic button for that?
Thanks.
Having just looked for the same thing a couple weeks ago, there isn't a perfect solution that I could find... This question was asked before:
Visual Studio: Printing all source files in a solution?
With the answer pointing to an old macro from MSDN here:
http://msdn.microsoft.com/en-us/library/ms973240.aspx
Another search turned up a result for a commercial product that claims to do what you're looking for, however, I haven't tried it and was unable to even find pricing:
http://submain.com/products/prettycode.print.net.aspx
Hope that helps, in the end I just opened all the files at once and just closed each one as I printed it. Not at all ideal, but it got the job done at the time.

Visual Studio 2008 and C#

I'm an IT Professional with a background with developing ASP/VBscript/SQL web applications. I want to take some training and get up to speed with Visual Studio 2008 and C# so that I can take over a project at work and make updates/bug fixes in house rather than calling in a third party.
The web application I'll be working on was developed in Visual Studio 2005 with a mix of C# code and some Ajax.
When I load the source code into Visual Studio 2008 I received a warning that the Source Control Plugin wasn't installed. It's looking for SourceSafe which I don't have. Is this necessary to use?
I'm starting a training course in February called Introduction to Visual Studio C# 2008. Well this be adequate to get me going in the right direction to be able to update, fix, and make minor changes to our web application? This is a big opportunity for me and I don't want to blow it.
Thanks!
SourceSafe is a Software Configuration Management tool from Microsoft, and is not required. I WOULD recommend using some form of SCM, but flavor is a matter of preference.
If the pop-ups are annoying to you and you would like to disable them, then removing the SourceSafe bindings from the project should stop them.
From http://weblogs.asp.net/bkcarroll/archive/2004/03/08/86059.aspx :
Solution:
1 - Go to the folder containing the solution files and delete the following:
mssccprj.scc
MyProject.vssscc
vssver.scc
2 - Open MyProject.sln in your favorite text editor and remove the following section:
GlobalSection(SourceCodeControl) = preSolution
...
EndGlobalSection
3 - Go to the folder containing the project files and delete the following:
MyProject.vbproj.vspscc
mssccprj.scc
vssver.scc
4 - Open MyProject.vbproj in your text editor and remove the following lines:
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
Now you can open the solution/project with no source control errors.
As far as the class goes, if you're already familiar with ASP/VBScript, you can probably pick up a C# class and figure out the rest. If not, I would suggest going for an ASP focused class that utilizes a C# back-end.
I would expect that a course named "Introduction to Visual Studio C# 2008" would probably not cover Ajax technologies, so you might want to look for some additional resources on that topic. (It might not even cover ASP.NET in significant depth, so I'd advise checking the syllabus, and if the ASP.NET coverage is weak then prepare for some additional learning on that topic as well.)
Re the Source Safe plug-in: you will need this if you want to work on the code base (so you can check in and out of the existing VSS repository). You will not need it just to browse the code.
Well James that is up to you. I am not familer with the course but if you apply yourself and pay attention I'm sure you can achive your goal. Do not be afraid to move beyond just course work to learn new things. There is a lot of information about Visual Studio on the internet.
SourceSafe is not required to use Visual Studio.
Learning the basics of VS will definitely allow you to update and fix your web apps. VS allows you to work with all the technologies you mentioned all in one environment. Although ASP/VBScript are "legacy" at this point, there is still support for them in the VS environment.
James I'd suggest that you look at the free resources (video and textual) available to you on ASP.NET. I would presume that once you've read a few tutorials and watched some videos + taken your training course you should be able to maintain the code base. Add in the fact that sites like StackOverflow have a large .NET community and there are always people willing to help.
Good luck

Categories