Sharepoint: automatically create subfolders - database

I have a question. I hope someone can help me out on this one.
I'm setting up a sharepoint-site for a client of ours. There's a document library ("Customers"), in which every Customer has one folder (=customername) with 4 sub-folders.
The subfolders are always the same ("Technical Information", "Documents", "Security information" & "Hardware").
What I would like to happen is whenever a new folder is created in the library (that is whenever a new customer is entered), the 4 subfolders are automatically created in that new folder.
I wanted to do this in a db-trigger & I found out that for every folder in the library, a record is created in the db-table dbo.AllDocs.
The thing is:
- there are about 63 columns in that table & the purpose off some of them is not clear to me.
- actually this isn't such a great id since writing in the WSS Content db via a script is
anyone got any idea's?
Thanks in advance for feedback!

Its is not recommended (I would say Should not) to touch the SharePoint DB. Always do your customization through the SharePoint UI or the ample number of other options you have with the SharePoint. For your case I would recommend to create a New Event Handler that will be attached to the Doc Lib. When you create a Folder (Top Level Customer) you need to create the respective sub folders. You also make sure that the Event Handler doesn't get trapped in the Recursion while creating the sub folders.
Refer the below links to Event Handler 1 2

I would suggest you to add this functionality in a feature. For example could you add an extra link in the New drop down menu item in the document library toolbar called "New customer".
In the code for this command, create the 4 folders programmatically.
This would mean that you don't have to worry about determine whether you are creating a customer folder or a normal folder in your event handler.

Related

Where do i put mdl files for function SetModel

I am new in lua and gmod coding. I have already coded successfully a HUD's addons but i am stuck in another.
I want to create a new entity, and after reading lots of tutorial, i manage to do it but in game, the word ERROR appears in red when spawning, not the model. The server and the client are located on the same PC, for debugging considerations. I try to put mdl files on several folders without aby change.
I put mdl file in
addons/models/model.mdl
I think the client doesn't find the model file : do i need a workshop content even for testing ? Where do i put the files ?
Thanks.
I got it. When reusing existing MDL file, i must keep the original path for files.
That is, when opening mdl file, a path is writing at the begining. This path must be the same in the models subfolder of the addons (path and filename).

Redmine: How to link an attached file in a project from its underprojects?

Lets say I have Project A with an attached imageFile.
Then I created 10 different Projects which are underprojects of Project A.
I want to link the ImageFile of Project A to the Wiki of every underproject , so that I can see the ImageFile in the Wiki-Area of each underproject.
What im doing so far is to copy full path of the attached file of Project A in the Wiki of every underproject, like for example:
!>/attachments/download/157/schnittprofil.png!
Is there a better way to achieve that, because every time I update the imagefile, I have to renew the id-numbers of all imagefile-links in the underprojects.
Since an attachment is only actually identified by its ID and all attachments are immutable (i.e. can be changed after upload), new uploads will result in a new ID. Since multiple attachments with different IDs can have the same name, you can also not reliably find an attachment just by using its name in broad contexts.
That said, to solve your issue, you could use the include macro to include a common Wiki page in your sub-project's wiki pages which then displays the image attachment.
For that, you can create a Wiki page named e.g. Schnittprofil in your parent project where you directly upload your file. In the wiki page, just reference the image with
!schnittprofil.png!
Assuming the parent project has an identifier of project-a, you can then include the page in other wiki pages with
{{include(project-a:Schnittprofil)}}
Each time you change the page on the parent project, it will automatically also show the updated content on the child wikis. The only requirement is that the users need to be able to read the wiki of your parent project (e.g. are members of the project with the "Read wiki" permission).

How to handle Solutions, Projects and their contents in a VisualStudio extension

In short:
I'm new to VisualStudio Extensibility and my goal is to create an extension with a ToolWindow (which already works) showing different views for each context of a VisualStudio solution, i. e. a view for the solution, a view for a project etc.. The window should be opened by clicking on a context menu entry in the context menus of the Solution Explorer, Class View, Object Browser and (ideally) any other window showing contents like projects, namespaces, classes etc..
After searching I found a lot of information, but for some points I couldn't find very helpful information. How do I ...
... create a context menu item for the VisualStudio views?
... get the currently open solution as an instance in code?
... get the projects of the solution and their contens as instances in code?
... add/remove items to/from a solution/project/class/... in code?
... react to selection changes in the Solution Explorer?
What I've done, so far:
I read the docs for Starting to Develop Visual Studio Extensions and downloaded the VSSDK-Extensibility-Samples. Especially the WPF_Toolwindow example was interesting for my purposes, so I built and ran it, which was successful, so far. Another interesting sample would have been the WPFDesigner_XML, but it always throws a NullReferenceException, so I decided to stick with the former ToolWindow, which is completely fine, for now.
Furtermore, I tried to understand the example by having a close look at each file in the project, running it in the debugger and analyzing what happened. I'm confident I understood it, but am also open for corrections of my possibly misguided thoughts following.
Now, I have created a new project, based on the WPF_Toolwindow sample, renamed and adapted to my needs (basically, I created new GUIDs, renamed the namespaces and removed things I won't use). This extension still works in the debugger. I even uninstalled everything from the experimental instance and debugged the extension from scratch.
What I try to achieve:
Have the ToolWindow load a specific view/viewmodel, when the selection changes in the Solution Explorer (or any other VisualStudio view). Alternatively, there should be a context menu item for every node's context menu in the Solution Explorer tree (or any other VisualStudio view).
Get the currently open solution, the containing projects and basically everything from the Solution Explorer's content as instances processable in my viewmodel. I need to properly add/remove
classes/structs/enums to/from
a folder in a project
a namespace
properties/fields to/from a class/struct
Generate code based on information of the solution and add the file properly to a project.
Does anyone know of examples for something like this or can anyone give me some hints, where I can find further information? Any help would be appreciated. Thanks in advance.
(1) The items already have a context menu and I want to add a new command to this menu.
if you want to add a sub menu to the context menu, the following link provide a complete sample
https://github.com/visualstudioextensibility/VSX-Samples/tree/master/CommandSubmenu
(3) Yes, basically adding a file to a project without manually manipulating the project file would be nice.
You can add the file to project via Project.ProjectItems.AddFromFile, and the following provide a sample for your reference.
https://www.mztools.com/Articles/2014/MZ2014009.aspx
Update:
I select a project and a similar event is fired. Are there such events I can subscribe to?
You could use IVsMonitorSelection to implement. here is the code which retrieve related project path for your reference.
IntPtr hierarchyPointer, selectionContainerPointer;
Object selectedObject = null;
IVsMultiItemSelect multiItemSelect;
uint projectItemId;
IVsMonitorSelection monitorSelection =
(IVsMonitorSelection)Package.GetGlobalService(
typeof(SVsShellMonitorSelection));
monitorSelection.GetCurrentSelection(out hierarchyPointer,
out projectItemId,
out multiItemSelect,
out selectionContainerPointer);
IVsHierarchy selectedHierarchy = Marshal.GetTypedObjectForIUnknown(
hierarchyPointer,
typeof(IVsHierarchy)) as IVsHierarchy;
if (selectedHierarchy != null)
{
ErrorHandler.ThrowOnFailure(selectedHierarchy.GetProperty(
projectItemId,
(int)__VSHPROPID.VSHPROPID_ExtObject,
out selectedObject));
}
Project selectedProject = selectedObject as Project;
string projectPath = selectedProject.FullName;
For more information about the usage, please refer to:
https://www.mztools.com/articles/2007/mz2007024.aspx

XP - Context Menu - Move Selected Files to a Specific Folder

G'day all and thanks for your help. Every now and then I have to copy downloaded files (after changing them) to a specific folder. In this example lets say d:\myfolder. I want to be able to do this quick with no hassles.
It was suggested that I look at the registry and the windows context menu. Truth be told I have no idea what to do.
Simply put; How do I MOVE files I selected to d:\myfolder from the context menu?
If possible greatly appreciated.
Thank you.
PS: The closest I could find was:
http://thismatter.com/tutorials/software/windows-xp/copy-move-files-more-efficiently.htm
This is almost there but cannot specify a specific folder.
Oof, a bit late in finding this question and responding, but here goes...
I want to do the same thing you're requesting, with the same aim: to do so in as few steps as possible.
The simplest solution for you would be to just create a shortcut for the target folder to which you wish to direct your files, and then move that shortcut into your "Send To" folder.
One add'l tip on this approach: selecting the target folder shortcut in the "Send To" menu will copy your file to the selected location; however, selecting the folder when also holding down the SHIFT key will move the file to that folder, instead.

How to start the associated program when selecting more than one files?

I have set .jpg file associated to my own program. I want to add the context menu to .jpg files, so I set the entry of HKCR.jpg\shell\open\command to "myProg.exe %1". After associating, there will be an item on the top of the context menu saying "Open image with myprog". This works right when I select a single .jpg file, but when I selected more than one file and click the top item of the context menu, nothing happended. How can I solve the problem?
Thank you very much
Each selected file will be sent to a new instance of your application. Your application should check if a previous version exists, or not. If a previous instance exists, it should sent its parameters to it (e.g. using Windows Messages) and then terminate.
Another approach is to use DDE (Dynamic Data Exchange), an old method used by Shell to send all files to one instance of your program.
You might need double quotes around the "%1".
Read this article for much more detailed information about how all this works.
http://msdn.microsoft.com/en-us/library/bb776883.aspx
Also, this blog entry talks about what you need to do specifically for multi-select command execution: http://blogs.msdn.com/pix/archive/2006/06/30/652889.aspx

Resources